randmarcomps 1.319.0 → 1.321.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.
@@ -422,7 +422,7 @@
422
422
  *
423
423
  * This source code is licensed under the ISC license.
424
424
  * See the LICENSE file in the root directory of this source tree.
425
- */const __iconNode=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],X$1=createLucideIcon("X",__iconNode);function r(t){var e,n,o="";if(typeof t=="string"||typeof t=="number")o+=t;else if(typeof t=="object")if(Array.isArray(t)){var l=t.length;for(e=0;e<l;e++)t[e]&&(n=r(t[e]))&&(o&&(o+=" "),o+=n)}else for(n in t)t[n]&&(o&&(o+=" "),o+=n);return o}function clsx(){for(var t,e,n=0,o="",l=arguments.length;n<l;n++)(t=arguments[n])&&(e=r(t))&&(o&&(o+=" "),o+=e);return o}const CLASS_PART_SEPARATOR="-",createClassGroupUtils=t=>{const e=createClassMap(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=t;return{getClassGroupId:f=>{const g=f.split(CLASS_PART_SEPARATOR);return g[0]===""&&g.length!==1&&g.shift(),getGroupRecursive(g,e)||getGroupIdForArbitraryProperty(f)},getConflictingClassGroupIds:(f,g)=>{const b=n[f]||[];return g&&o[f]?[...b,...o[f]]:b}}},getGroupRecursive=(t,e)=>{var f;if(t.length===0)return e.classGroupId;const n=t[0],o=e.nextPart.get(n),l=o?getGroupRecursive(t.slice(1),o):void 0;if(l)return l;if(e.validators.length===0)return;const d=t.join(CLASS_PART_SEPARATOR);return(f=e.validators.find(({validator:g})=>g(d)))==null?void 0:f.classGroupId},arbitraryPropertyRegex=/^\[(.+)\]$/,getGroupIdForArbitraryProperty=t=>{if(arbitraryPropertyRegex.test(t)){const e=arbitraryPropertyRegex.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},createClassMap=t=>{const{theme:e,classGroups:n}=t,o={nextPart:new Map,validators:[]};for(const l in n)processClassesRecursively(n[l],o,l,e);return o},processClassesRecursively=(t,e,n,o)=>{t.forEach(l=>{if(typeof l=="string"){const d=l===""?e:getPart(e,l);d.classGroupId=n;return}if(typeof l=="function"){if(isThemeGetter(l)){processClassesRecursively(l(o),e,n,o);return}e.validators.push({validator:l,classGroupId:n});return}Object.entries(l).forEach(([d,f])=>{processClassesRecursively(f,getPart(e,d),n,o)})})},getPart=(t,e)=>{let n=t;return e.split(CLASS_PART_SEPARATOR).forEach(o=>{n.nextPart.has(o)||n.nextPart.set(o,{nextPart:new Map,validators:[]}),n=n.nextPart.get(o)}),n},isThemeGetter=t=>t.isThemeGetter,createLruCache=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,o=new Map;const l=(d,f)=>{n.set(d,f),e++,e>t&&(e=0,o=n,n=new Map)};return{get(d){let f=n.get(d);if(f!==void 0)return f;if((f=o.get(d))!==void 0)return l(d,f),f},set(d,f){n.has(d)?n.set(d,f):l(d,f)}}},IMPORTANT_MODIFIER="!",MODIFIER_SEPARATOR=":",MODIFIER_SEPARATOR_LENGTH=MODIFIER_SEPARATOR.length,createParseClassName=t=>{const{prefix:e,experimentalParseClassName:n}=t;let o=l=>{const d=[];let f=0,g=0,b=0,_;for(let A=0;A<l.length;A++){let M=l[A];if(f===0&&g===0){if(M===MODIFIER_SEPARATOR){d.push(l.slice(b,A)),b=A+MODIFIER_SEPARATOR_LENGTH;continue}if(M==="/"){_=A;continue}}M==="["?f++:M==="]"?f--:M==="("?g++:M===")"&&g--}const S=d.length===0?l:l.substring(b),R=stripImportantModifier(S),C=R!==S,E=_&&_>b?_-b:void 0;return{modifiers:d,hasImportantModifier:C,baseClassName:R,maybePostfixModifierPosition:E}};if(e){const l=e+MODIFIER_SEPARATOR,d=o;o=f=>f.startsWith(l)?d(f.substring(l.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:f,maybePostfixModifierPosition:void 0}}if(n){const l=o;o=d=>n({className:d,parseClassName:l})}return o},stripImportantModifier=t=>t.endsWith(IMPORTANT_MODIFIER)?t.substring(0,t.length-1):t.startsWith(IMPORTANT_MODIFIER)?t.substring(1):t,createSortModifiers=t=>{const e=Object.fromEntries(t.orderSensitiveModifiers.map(o=>[o,!0]));return o=>{if(o.length<=1)return o;const l=[];let d=[];return o.forEach(f=>{f[0]==="["||e[f]?(l.push(...d.sort(),f),d=[]):d.push(f)}),l.push(...d.sort()),l}},createConfigUtils=t=>({cache:createLruCache(t.cacheSize),parseClassName:createParseClassName(t),sortModifiers:createSortModifiers(t),...createClassGroupUtils(t)}),SPLIT_CLASSES_REGEX=/\s+/,mergeClassList=(t,e)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:l,sortModifiers:d}=e,f=[],g=t.trim().split(SPLIT_CLASSES_REGEX);let b="";for(let _=g.length-1;_>=0;_-=1){const S=g[_],{isExternal:R,modifiers:C,hasImportantModifier:E,baseClassName:A,maybePostfixModifierPosition:M}=n(S);if(R){b=S+(b.length>0?" "+b:b);continue}let I=!!M,j=o(I?A.substring(0,M):A);if(!j){if(!I){b=S+(b.length>0?" "+b:b);continue}if(j=o(A),!j){b=S+(b.length>0?" "+b:b);continue}I=!1}const q=d(C).join(":"),z=E?q+IMPORTANT_MODIFIER:q,Q=z+j;if(f.includes(Q))continue;f.push(Q);const F=l(j,I);for(let V=0;V<F.length;++V){const te=F[V];f.push(z+te)}b=S+(b.length>0?" "+b:b)}return b};function twJoin(){let t=0,e,n,o="";for(;t<arguments.length;)(e=arguments[t++])&&(n=toValue(e))&&(o&&(o+=" "),o+=n);return o}const toValue=t=>{if(typeof t=="string")return t;let e,n="";for(let o=0;o<t.length;o++)t[o]&&(e=toValue(t[o]))&&(n&&(n+=" "),n+=e);return n};function createTailwindMerge(t,...e){let n,o,l,d=f;function f(b){const _=e.reduce((S,R)=>R(S),t());return n=createConfigUtils(_),o=n.cache.get,l=n.cache.set,d=g,g(b)}function g(b){const _=o(b);if(_)return _;const S=mergeClassList(b,n);return l(b,S),S}return function(){return d(twJoin.apply(null,arguments))}}const fromTheme=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},arbitraryValueRegex=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,arbitraryVariableRegex=/^\((?:(\w[\w-]*):)?(.+)\)$/i,fractionRegex=/^\d+\/\d+$/,tshirtUnitRegex=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,lengthUnitRegex=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,colorFunctionRegex=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,shadowRegex=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,imageRegex=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,isFraction=t=>fractionRegex.test(t),isNumber$4=t=>!!t&&!Number.isNaN(Number(t)),isInteger=t=>!!t&&Number.isInteger(Number(t)),isPercent$1=t=>t.endsWith("%")&&isNumber$4(t.slice(0,-1)),isTshirtSize=t=>tshirtUnitRegex.test(t),isAny=()=>!0,isLengthOnly=t=>lengthUnitRegex.test(t)&&!colorFunctionRegex.test(t),isNever=()=>!1,isShadow=t=>shadowRegex.test(t),isImage=t=>imageRegex.test(t),isAnyNonArbitrary=t=>!isArbitraryValue(t)&&!isArbitraryVariable(t),isArbitrarySize=t=>getIsArbitraryValue(t,isLabelSize,isNever),isArbitraryValue=t=>arbitraryValueRegex.test(t),isArbitraryLength=t=>getIsArbitraryValue(t,isLabelLength,isLengthOnly),isArbitraryNumber=t=>getIsArbitraryValue(t,isLabelNumber,isNumber$4),isArbitraryPosition=t=>getIsArbitraryValue(t,isLabelPosition,isNever),isArbitraryImage=t=>getIsArbitraryValue(t,isLabelImage,isImage),isArbitraryShadow=t=>getIsArbitraryValue(t,isLabelShadow,isShadow),isArbitraryVariable=t=>arbitraryVariableRegex.test(t),isArbitraryVariableLength=t=>getIsArbitraryVariable(t,isLabelLength),isArbitraryVariableFamilyName=t=>getIsArbitraryVariable(t,isLabelFamilyName),isArbitraryVariablePosition=t=>getIsArbitraryVariable(t,isLabelPosition),isArbitraryVariableSize=t=>getIsArbitraryVariable(t,isLabelSize),isArbitraryVariableImage=t=>getIsArbitraryVariable(t,isLabelImage),isArbitraryVariableShadow=t=>getIsArbitraryVariable(t,isLabelShadow,!0),getIsArbitraryValue=(t,e,n)=>{const o=arbitraryValueRegex.exec(t);return o?o[1]?e(o[1]):n(o[2]):!1},getIsArbitraryVariable=(t,e,n=!1)=>{const o=arbitraryVariableRegex.exec(t);return o?o[1]?e(o[1]):n:!1},isLabelPosition=t=>t==="position"||t==="percentage",isLabelImage=t=>t==="image"||t==="url",isLabelSize=t=>t==="length"||t==="size"||t==="bg-size",isLabelLength=t=>t==="length",isLabelNumber=t=>t==="number",isLabelFamilyName=t=>t==="family-name",isLabelShadow=t=>t==="shadow",getDefaultConfig=()=>{const t=fromTheme("color"),e=fromTheme("font"),n=fromTheme("text"),o=fromTheme("font-weight"),l=fromTheme("tracking"),d=fromTheme("leading"),f=fromTheme("breakpoint"),g=fromTheme("container"),b=fromTheme("spacing"),_=fromTheme("radius"),S=fromTheme("shadow"),R=fromTheme("inset-shadow"),C=fromTheme("text-shadow"),E=fromTheme("drop-shadow"),A=fromTheme("blur"),M=fromTheme("perspective"),I=fromTheme("aspect"),j=fromTheme("ease"),q=fromTheme("animate"),z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Q=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],F=()=>[...Q(),isArbitraryVariable,isArbitraryValue],V=()=>["auto","hidden","clip","visible","scroll"],te=()=>["auto","contain","none"],ne=()=>[isArbitraryVariable,isArbitraryValue,b],se=()=>[isFraction,"full","auto",...ne()],ge=()=>[isInteger,"none","subgrid",isArbitraryVariable,isArbitraryValue],oe=()=>["auto",{span:["full",isInteger,isArbitraryVariable,isArbitraryValue]},isInteger,isArbitraryVariable,isArbitraryValue],Ae=()=>[isInteger,"auto",isArbitraryVariable,isArbitraryValue],je=()=>["auto","min","max","fr",isArbitraryVariable,isArbitraryValue],Ne=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Oe=()=>["start","end","center","stretch","center-safe","end-safe"],Fe=()=>["auto",...ne()],ze=()=>[isFraction,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...ne()],$e=()=>[t,isArbitraryVariable,isArbitraryValue],Be=()=>[...Q(),isArbitraryVariablePosition,isArbitraryPosition,{position:[isArbitraryVariable,isArbitraryValue]}],qe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Ge=()=>["auto","cover","contain",isArbitraryVariableSize,isArbitrarySize,{size:[isArbitraryVariable,isArbitraryValue]}],He=()=>[isPercent$1,isArbitraryVariableLength,isArbitraryLength],Ze=()=>["","none","full",_,isArbitraryVariable,isArbitraryValue],tt=()=>["",isNumber$4,isArbitraryVariableLength,isArbitraryLength],Ye=()=>["solid","dashed","dotted","double"],Qe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Xe=()=>[isNumber$4,isPercent$1,isArbitraryVariablePosition,isArbitraryPosition],st=()=>["","none",A,isArbitraryVariable,isArbitraryValue],rt=()=>["none",isNumber$4,isArbitraryVariable,isArbitraryValue],at=()=>["none",isNumber$4,isArbitraryVariable,isArbitraryValue],ot=()=>[isNumber$4,isArbitraryVariable,isArbitraryValue],Ue=()=>[isFraction,"full",...ne()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[isTshirtSize],breakpoint:[isTshirtSize],color:[isAny],container:[isTshirtSize],"drop-shadow":[isTshirtSize],ease:["in","out","in-out"],font:[isAnyNonArbitrary],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[isTshirtSize],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[isTshirtSize],shadow:[isTshirtSize],spacing:["px",isNumber$4],text:[isTshirtSize],"text-shadow":[isTshirtSize],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",isFraction,isArbitraryValue,isArbitraryVariable,I]}],container:["container"],columns:[{columns:[isNumber$4,isArbitraryValue,isArbitraryVariable,g]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:F()}],overflow:[{overflow:V()}],"overflow-x":[{"overflow-x":V()}],"overflow-y":[{"overflow-y":V()}],overscroll:[{overscroll:te()}],"overscroll-x":[{"overscroll-x":te()}],"overscroll-y":[{"overscroll-y":te()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:se()}],"inset-x":[{"inset-x":se()}],"inset-y":[{"inset-y":se()}],start:[{start:se()}],end:[{end:se()}],top:[{top:se()}],right:[{right:se()}],bottom:[{bottom:se()}],left:[{left:se()}],visibility:["visible","invisible","collapse"],z:[{z:[isInteger,"auto",isArbitraryVariable,isArbitraryValue]}],basis:[{basis:[isFraction,"full","auto",g,...ne()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[isNumber$4,isFraction,"auto","initial","none",isArbitraryValue]}],grow:[{grow:["",isNumber$4,isArbitraryVariable,isArbitraryValue]}],shrink:[{shrink:["",isNumber$4,isArbitraryVariable,isArbitraryValue]}],order:[{order:[isInteger,"first","last","none",isArbitraryVariable,isArbitraryValue]}],"grid-cols":[{"grid-cols":ge()}],"col-start-end":[{col:oe()}],"col-start":[{"col-start":Ae()}],"col-end":[{"col-end":Ae()}],"grid-rows":[{"grid-rows":ge()}],"row-start-end":[{row:oe()}],"row-start":[{"row-start":Ae()}],"row-end":[{"row-end":Ae()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":je()}],"auto-rows":[{"auto-rows":je()}],gap:[{gap:ne()}],"gap-x":[{"gap-x":ne()}],"gap-y":[{"gap-y":ne()}],"justify-content":[{justify:[...Ne(),"normal"]}],"justify-items":[{"justify-items":[...Oe(),"normal"]}],"justify-self":[{"justify-self":["auto",...Oe()]}],"align-content":[{content:["normal",...Ne()]}],"align-items":[{items:[...Oe(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Oe(),{baseline:["","last"]}]}],"place-content":[{"place-content":Ne()}],"place-items":[{"place-items":[...Oe(),"baseline"]}],"place-self":[{"place-self":["auto",...Oe()]}],p:[{p:ne()}],px:[{px:ne()}],py:[{py:ne()}],ps:[{ps:ne()}],pe:[{pe:ne()}],pt:[{pt:ne()}],pr:[{pr:ne()}],pb:[{pb:ne()}],pl:[{pl:ne()}],m:[{m:Fe()}],mx:[{mx:Fe()}],my:[{my:Fe()}],ms:[{ms:Fe()}],me:[{me:Fe()}],mt:[{mt:Fe()}],mr:[{mr:Fe()}],mb:[{mb:Fe()}],ml:[{ml:Fe()}],"space-x":[{"space-x":ne()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":ne()}],"space-y-reverse":["space-y-reverse"],size:[{size:ze()}],w:[{w:[g,"screen",...ze()]}],"min-w":[{"min-w":[g,"screen","none",...ze()]}],"max-w":[{"max-w":[g,"screen","none","prose",{screen:[f]},...ze()]}],h:[{h:["screen","lh",...ze()]}],"min-h":[{"min-h":["screen","lh","none",...ze()]}],"max-h":[{"max-h":["screen","lh",...ze()]}],"font-size":[{text:["base",n,isArbitraryVariableLength,isArbitraryLength]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,isArbitraryVariable,isArbitraryNumber]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",isPercent$1,isArbitraryValue]}],"font-family":[{font:[isArbitraryVariableFamilyName,isArbitraryValue,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[l,isArbitraryVariable,isArbitraryValue]}],"line-clamp":[{"line-clamp":[isNumber$4,"none",isArbitraryVariable,isArbitraryNumber]}],leading:[{leading:[d,...ne()]}],"list-image":[{"list-image":["none",isArbitraryVariable,isArbitraryValue]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",isArbitraryVariable,isArbitraryValue]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:$e()}],"text-color":[{text:$e()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ye(),"wavy"]}],"text-decoration-thickness":[{decoration:[isNumber$4,"from-font","auto",isArbitraryVariable,isArbitraryLength]}],"text-decoration-color":[{decoration:$e()}],"underline-offset":[{"underline-offset":[isNumber$4,"auto",isArbitraryVariable,isArbitraryValue]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:ne()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",isArbitraryVariable,isArbitraryValue]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",isArbitraryVariable,isArbitraryValue]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Be()}],"bg-repeat":[{bg:qe()}],"bg-size":[{bg:Ge()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},isInteger,isArbitraryVariable,isArbitraryValue],radial:["",isArbitraryVariable,isArbitraryValue],conic:[isInteger,isArbitraryVariable,isArbitraryValue]},isArbitraryVariableImage,isArbitraryImage]}],"bg-color":[{bg:$e()}],"gradient-from-pos":[{from:He()}],"gradient-via-pos":[{via:He()}],"gradient-to-pos":[{to:He()}],"gradient-from":[{from:$e()}],"gradient-via":[{via:$e()}],"gradient-to":[{to:$e()}],rounded:[{rounded:Ze()}],"rounded-s":[{"rounded-s":Ze()}],"rounded-e":[{"rounded-e":Ze()}],"rounded-t":[{"rounded-t":Ze()}],"rounded-r":[{"rounded-r":Ze()}],"rounded-b":[{"rounded-b":Ze()}],"rounded-l":[{"rounded-l":Ze()}],"rounded-ss":[{"rounded-ss":Ze()}],"rounded-se":[{"rounded-se":Ze()}],"rounded-ee":[{"rounded-ee":Ze()}],"rounded-es":[{"rounded-es":Ze()}],"rounded-tl":[{"rounded-tl":Ze()}],"rounded-tr":[{"rounded-tr":Ze()}],"rounded-br":[{"rounded-br":Ze()}],"rounded-bl":[{"rounded-bl":Ze()}],"border-w":[{border:tt()}],"border-w-x":[{"border-x":tt()}],"border-w-y":[{"border-y":tt()}],"border-w-s":[{"border-s":tt()}],"border-w-e":[{"border-e":tt()}],"border-w-t":[{"border-t":tt()}],"border-w-r":[{"border-r":tt()}],"border-w-b":[{"border-b":tt()}],"border-w-l":[{"border-l":tt()}],"divide-x":[{"divide-x":tt()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":tt()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ye(),"hidden","none"]}],"divide-style":[{divide:[...Ye(),"hidden","none"]}],"border-color":[{border:$e()}],"border-color-x":[{"border-x":$e()}],"border-color-y":[{"border-y":$e()}],"border-color-s":[{"border-s":$e()}],"border-color-e":[{"border-e":$e()}],"border-color-t":[{"border-t":$e()}],"border-color-r":[{"border-r":$e()}],"border-color-b":[{"border-b":$e()}],"border-color-l":[{"border-l":$e()}],"divide-color":[{divide:$e()}],"outline-style":[{outline:[...Ye(),"none","hidden"]}],"outline-offset":[{"outline-offset":[isNumber$4,isArbitraryVariable,isArbitraryValue]}],"outline-w":[{outline:["",isNumber$4,isArbitraryVariableLength,isArbitraryLength]}],"outline-color":[{outline:$e()}],shadow:[{shadow:["","none",S,isArbitraryVariableShadow,isArbitraryShadow]}],"shadow-color":[{shadow:$e()}],"inset-shadow":[{"inset-shadow":["none",R,isArbitraryVariableShadow,isArbitraryShadow]}],"inset-shadow-color":[{"inset-shadow":$e()}],"ring-w":[{ring:tt()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$e()}],"ring-offset-w":[{"ring-offset":[isNumber$4,isArbitraryLength]}],"ring-offset-color":[{"ring-offset":$e()}],"inset-ring-w":[{"inset-ring":tt()}],"inset-ring-color":[{"inset-ring":$e()}],"text-shadow":[{"text-shadow":["none",C,isArbitraryVariableShadow,isArbitraryShadow]}],"text-shadow-color":[{"text-shadow":$e()}],opacity:[{opacity:[isNumber$4,isArbitraryVariable,isArbitraryValue]}],"mix-blend":[{"mix-blend":[...Qe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Qe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[isNumber$4]}],"mask-image-linear-from-pos":[{"mask-linear-from":Xe()}],"mask-image-linear-to-pos":[{"mask-linear-to":Xe()}],"mask-image-linear-from-color":[{"mask-linear-from":$e()}],"mask-image-linear-to-color":[{"mask-linear-to":$e()}],"mask-image-t-from-pos":[{"mask-t-from":Xe()}],"mask-image-t-to-pos":[{"mask-t-to":Xe()}],"mask-image-t-from-color":[{"mask-t-from":$e()}],"mask-image-t-to-color":[{"mask-t-to":$e()}],"mask-image-r-from-pos":[{"mask-r-from":Xe()}],"mask-image-r-to-pos":[{"mask-r-to":Xe()}],"mask-image-r-from-color":[{"mask-r-from":$e()}],"mask-image-r-to-color":[{"mask-r-to":$e()}],"mask-image-b-from-pos":[{"mask-b-from":Xe()}],"mask-image-b-to-pos":[{"mask-b-to":Xe()}],"mask-image-b-from-color":[{"mask-b-from":$e()}],"mask-image-b-to-color":[{"mask-b-to":$e()}],"mask-image-l-from-pos":[{"mask-l-from":Xe()}],"mask-image-l-to-pos":[{"mask-l-to":Xe()}],"mask-image-l-from-color":[{"mask-l-from":$e()}],"mask-image-l-to-color":[{"mask-l-to":$e()}],"mask-image-x-from-pos":[{"mask-x-from":Xe()}],"mask-image-x-to-pos":[{"mask-x-to":Xe()}],"mask-image-x-from-color":[{"mask-x-from":$e()}],"mask-image-x-to-color":[{"mask-x-to":$e()}],"mask-image-y-from-pos":[{"mask-y-from":Xe()}],"mask-image-y-to-pos":[{"mask-y-to":Xe()}],"mask-image-y-from-color":[{"mask-y-from":$e()}],"mask-image-y-to-color":[{"mask-y-to":$e()}],"mask-image-radial":[{"mask-radial":[isArbitraryVariable,isArbitraryValue]}],"mask-image-radial-from-pos":[{"mask-radial-from":Xe()}],"mask-image-radial-to-pos":[{"mask-radial-to":Xe()}],"mask-image-radial-from-color":[{"mask-radial-from":$e()}],"mask-image-radial-to-color":[{"mask-radial-to":$e()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":Q()}],"mask-image-conic-pos":[{"mask-conic":[isNumber$4]}],"mask-image-conic-from-pos":[{"mask-conic-from":Xe()}],"mask-image-conic-to-pos":[{"mask-conic-to":Xe()}],"mask-image-conic-from-color":[{"mask-conic-from":$e()}],"mask-image-conic-to-color":[{"mask-conic-to":$e()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Be()}],"mask-repeat":[{mask:qe()}],"mask-size":[{mask:Ge()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",isArbitraryVariable,isArbitraryValue]}],filter:[{filter:["","none",isArbitraryVariable,isArbitraryValue]}],blur:[{blur:st()}],brightness:[{brightness:[isNumber$4,isArbitraryVariable,isArbitraryValue]}],contrast:[{contrast:[isNumber$4,isArbitraryVariable,isArbitraryValue]}],"drop-shadow":[{"drop-shadow":["","none",E,isArbitraryVariableShadow,isArbitraryShadow]}],"drop-shadow-color":[{"drop-shadow":$e()}],grayscale:[{grayscale:["",isNumber$4,isArbitraryVariable,isArbitraryValue]}],"hue-rotate":[{"hue-rotate":[isNumber$4,isArbitraryVariable,isArbitraryValue]}],invert:[{invert:["",isNumber$4,isArbitraryVariable,isArbitraryValue]}],saturate:[{saturate:[isNumber$4,isArbitraryVariable,isArbitraryValue]}],sepia:[{sepia:["",isNumber$4,isArbitraryVariable,isArbitraryValue]}],"backdrop-filter":[{"backdrop-filter":["","none",isArbitraryVariable,isArbitraryValue]}],"backdrop-blur":[{"backdrop-blur":st()}],"backdrop-brightness":[{"backdrop-brightness":[isNumber$4,isArbitraryVariable,isArbitraryValue]}],"backdrop-contrast":[{"backdrop-contrast":[isNumber$4,isArbitraryVariable,isArbitraryValue]}],"backdrop-grayscale":[{"backdrop-grayscale":["",isNumber$4,isArbitraryVariable,isArbitraryValue]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[isNumber$4,isArbitraryVariable,isArbitraryValue]}],"backdrop-invert":[{"backdrop-invert":["",isNumber$4,isArbitraryVariable,isArbitraryValue]}],"backdrop-opacity":[{"backdrop-opacity":[isNumber$4,isArbitraryVariable,isArbitraryValue]}],"backdrop-saturate":[{"backdrop-saturate":[isNumber$4,isArbitraryVariable,isArbitraryValue]}],"backdrop-sepia":[{"backdrop-sepia":["",isNumber$4,isArbitraryVariable,isArbitraryValue]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":ne()}],"border-spacing-x":[{"border-spacing-x":ne()}],"border-spacing-y":[{"border-spacing-y":ne()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",isArbitraryVariable,isArbitraryValue]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[isNumber$4,"initial",isArbitraryVariable,isArbitraryValue]}],ease:[{ease:["linear","initial",j,isArbitraryVariable,isArbitraryValue]}],delay:[{delay:[isNumber$4,isArbitraryVariable,isArbitraryValue]}],animate:[{animate:["none",q,isArbitraryVariable,isArbitraryValue]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[M,isArbitraryVariable,isArbitraryValue]}],"perspective-origin":[{"perspective-origin":F()}],rotate:[{rotate:rt()}],"rotate-x":[{"rotate-x":rt()}],"rotate-y":[{"rotate-y":rt()}],"rotate-z":[{"rotate-z":rt()}],scale:[{scale:at()}],"scale-x":[{"scale-x":at()}],"scale-y":[{"scale-y":at()}],"scale-z":[{"scale-z":at()}],"scale-3d":["scale-3d"],skew:[{skew:ot()}],"skew-x":[{"skew-x":ot()}],"skew-y":[{"skew-y":ot()}],transform:[{transform:[isArbitraryVariable,isArbitraryValue,"","none","gpu","cpu"]}],"transform-origin":[{origin:F()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ue()}],"translate-x":[{"translate-x":Ue()}],"translate-y":[{"translate-y":Ue()}],"translate-z":[{"translate-z":Ue()}],"translate-none":["translate-none"],accent:[{accent:$e()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:$e()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",isArbitraryVariable,isArbitraryValue]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ne()}],"scroll-mx":[{"scroll-mx":ne()}],"scroll-my":[{"scroll-my":ne()}],"scroll-ms":[{"scroll-ms":ne()}],"scroll-me":[{"scroll-me":ne()}],"scroll-mt":[{"scroll-mt":ne()}],"scroll-mr":[{"scroll-mr":ne()}],"scroll-mb":[{"scroll-mb":ne()}],"scroll-ml":[{"scroll-ml":ne()}],"scroll-p":[{"scroll-p":ne()}],"scroll-px":[{"scroll-px":ne()}],"scroll-py":[{"scroll-py":ne()}],"scroll-ps":[{"scroll-ps":ne()}],"scroll-pe":[{"scroll-pe":ne()}],"scroll-pt":[{"scroll-pt":ne()}],"scroll-pr":[{"scroll-pr":ne()}],"scroll-pb":[{"scroll-pb":ne()}],"scroll-pl":[{"scroll-pl":ne()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",isArbitraryVariable,isArbitraryValue]}],fill:[{fill:["none",...$e()]}],"stroke-w":[{stroke:[isNumber$4,isArbitraryVariableLength,isArbitraryLength,isArbitraryNumber]}],stroke:[{stroke:["none",...$e()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},twMerge=createTailwindMerge(getDefaultConfig);function cn(...t){return twMerge(clsx(t))}const formatNumber=t=>new Intl.NumberFormat("en-CA").format(t),formatMoney=(t,e=2)=>new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:e,maximumFractionDigits:e}).format(t),formatYYYYMMDDIntToDateString=t=>{if(t===null||typeof t>"u")return"—";const e=t.toString();if(e.length===8){const n=e.substring(0,4),o=e.substring(4,6),l=e.substring(6,8);return`${n}-${o}-${l}`}return e};function InputOTP({className:t,containerClassName:e,...n}){return jsxRuntime.jsx(Lt,{"data-slot":"input-otp",containerClassName:cn("flex items-center gap-2 has-disabled:opacity-50",e),className:cn("disabled:cursor-not-allowed",t),...n})}function InputOTPGroup({className:t,...e}){return jsxRuntime.jsx("div",{"data-slot":"input-otp-group",className:cn("flex items-center",t),...e})}function InputOTPSlot({index:t,className:e,...n}){const o=React__namespace.useContext(jt),{char:l,hasFakeCaret:d,isActive:f}=(o==null?void 0:o.slots[t])??{};return jsxRuntime.jsxs("div",{"data-slot":"input-otp-slot","data-active":f,className:cn("border-input data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",e),...n,children:[l,d&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"animate-caret-blink bg-foreground h-4 w-px duration-1000"})})]})}function InputOTPSeparator({...t}){return jsxRuntime.jsx("div",{"data-slot":"input-otp-separator",role:"separator",...t,children:jsxRuntime.jsx(Minus,{})})}function composeEventHandlers(t,e,{checkForDefaultPrevented:n=!0}={}){return function(l){if(t==null||t(l),n===!1||!l.defaultPrevented)return e==null?void 0:e(l)}}function setRef(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function composeRefs(...t){return e=>{let n=!1;const o=t.map(l=>{const d=setRef(l,e);return!n&&typeof d=="function"&&(n=!0),d});if(n)return()=>{for(let l=0;l<o.length;l++){const d=o[l];typeof d=="function"?d():setRef(t[l],null)}}}}function useComposedRefs(...t){return React__namespace.useCallback(composeRefs(...t),t)}function createContext2(t,e){const n=React__namespace.createContext(e),o=d=>{const{children:f,...g}=d,b=React__namespace.useMemo(()=>g,Object.values(g));return jsxRuntime.jsx(n.Provider,{value:b,children:f})};o.displayName=t+"Provider";function l(d){const f=React__namespace.useContext(n);if(f)return f;if(e!==void 0)return e;throw new Error(`\`${d}\` must be used within \`${t}\``)}return[o,l]}function createContextScope(t,e=[]){let n=[];function o(d,f){const g=React__namespace.createContext(f),b=n.length;n=[...n,f];const _=R=>{var j;const{scope:C,children:E,...A}=R,M=((j=C==null?void 0:C[t])==null?void 0:j[b])||g,I=React__namespace.useMemo(()=>A,Object.values(A));return jsxRuntime.jsx(M.Provider,{value:I,children:E})};_.displayName=d+"Provider";function S(R,C){var M;const E=((M=C==null?void 0:C[t])==null?void 0:M[b])||g,A=React__namespace.useContext(E);if(A)return A;if(f!==void 0)return f;throw new Error(`\`${R}\` must be used within \`${d}\``)}return[_,S]}const l=()=>{const d=n.map(f=>React__namespace.createContext(f));return function(g){const b=(g==null?void 0:g[t])||d;return React__namespace.useMemo(()=>({[`__scope${t}`]:{...g,[t]:b}}),[g,b])}};return l.scopeName=t,[o,composeContextScopes(l,...e)]}function composeContextScopes(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const o=t.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(d){const f=o.reduce((g,{useScope:b,scopeName:_})=>{const R=b(d)[`__scope${_}`];return{...g,...R}},{});return React__namespace.useMemo(()=>({[`__scope${e.scopeName}`]:f}),[f])}};return n.scopeName=e.scopeName,n}function createSlot(t){const e=createSlotClone(t),n=React__namespace.forwardRef((o,l)=>{const{children:d,...f}=o,g=React__namespace.Children.toArray(d),b=g.find(isSlottable);if(b){const _=b.props.children,S=g.map(R=>R===b?React__namespace.Children.count(_)>1?React__namespace.Children.only(null):React__namespace.isValidElement(_)?_.props.children:null:R);return jsxRuntime.jsx(e,{...f,ref:l,children:React__namespace.isValidElement(_)?React__namespace.cloneElement(_,void 0,S):null})}return jsxRuntime.jsx(e,{...f,ref:l,children:d})});return n.displayName=`${t}.Slot`,n}var Slot$4=createSlot("Slot");function createSlotClone(t){const e=React__namespace.forwardRef((n,o)=>{const{children:l,...d}=n;if(React__namespace.isValidElement(l)){const f=getElementRef$1(l),g=mergeProps(d,l.props);return l.type!==React__namespace.Fragment&&(g.ref=o?composeRefs(o,f):f),React__namespace.cloneElement(l,g)}return React__namespace.Children.count(l)>1?React__namespace.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var SLOTTABLE_IDENTIFIER=Symbol("radix.slottable");function createSlottable(t){const e=({children:n})=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=SLOTTABLE_IDENTIFIER,e}function isSlottable(t){return React__namespace.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===SLOTTABLE_IDENTIFIER}function mergeProps(t,e){const n={...e};for(const o in e){const l=t[o],d=e[o];/^on[A-Z]/.test(o)?l&&d?n[o]=(...g)=>{const b=d(...g);return l(...g),b}:l&&(n[o]=l):o==="style"?n[o]={...l,...d}:o==="className"&&(n[o]=[l,d].filter(Boolean).join(" "))}return{...t,...n}}function getElementRef$1(t){var o,l;let e=(o=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(l=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:l.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var NODES=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Primitive=NODES.reduce((t,e)=>{const n=createSlot(`Primitive.${e}`),o=React__namespace.forwardRef((l,d)=>{const{asChild:f,...g}=l,b=f?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),jsxRuntime.jsx(b,{...g,ref:d})});return o.displayName=`Primitive.${e}`,{...t,[e]:o}},{});function dispatchDiscreteCustomEvent(t,e){t&&ReactDOM__namespace.flushSync(()=>t.dispatchEvent(e))}function createCollection(t){const e=t+"CollectionProvider",[n,o]=createContextScope(e),[l,d]=n(e,{collectionRef:{current:null},itemMap:new Map}),f=M=>{const{scope:I,children:j}=M,q=React.useRef(null),z=React.useRef(new Map).current;return jsxRuntime.jsx(l,{scope:I,itemMap:z,collectionRef:q,children:j})};f.displayName=e;const g=t+"CollectionSlot",b=createSlot(g),_=React.forwardRef((M,I)=>{const{scope:j,children:q}=M,z=d(g,j),Q=useComposedRefs(I,z.collectionRef);return jsxRuntime.jsx(b,{ref:Q,children:q})});_.displayName=g;const S=t+"CollectionItemSlot",R="data-radix-collection-item",C=createSlot(S),E=React.forwardRef((M,I)=>{const{scope:j,children:q,...z}=M,Q=React.useRef(null),F=useComposedRefs(I,Q),V=d(S,j);return React.useEffect(()=>(V.itemMap.set(Q,{ref:Q,...z}),()=>void V.itemMap.delete(Q))),jsxRuntime.jsx(C,{[R]:"",ref:F,children:q})});E.displayName=S;function A(M){const I=d(t+"CollectionConsumer",M);return React.useCallback(()=>{const q=I.collectionRef.current;if(!q)return[];const z=Array.from(q.querySelectorAll(`[${R}]`));return Array.from(I.itemMap.values()).sort((V,te)=>z.indexOf(V.ref.current)-z.indexOf(te.ref.current))},[I.collectionRef,I.itemMap])}return[{Provider:f,Slot:_,ItemSlot:E},A,o]}var useLayoutEffect2=globalThis!=null&&globalThis.document?React__namespace.useLayoutEffect:()=>{},useReactId=React__namespace[" useId ".trim().toString()]||(()=>{}),count$3=0;function useId(t){const[e,n]=React__namespace.useState(useReactId());return useLayoutEffect2(()=>{n(o=>o??String(count$3++))},[t]),e?`radix-${e}`:""}function useCallbackRef$1(t){const e=React__namespace.useRef(t);return React__namespace.useEffect(()=>{e.current=t}),React__namespace.useMemo(()=>(...n)=>{var o;return(o=e.current)==null?void 0:o.call(e,...n)},[])}var useInsertionEffect=React__namespace[" useInsertionEffect ".trim().toString()]||useLayoutEffect2;function useControllableState({prop:t,defaultProp:e,onChange:n=()=>{},caller:o}){const[l,d,f]=useUncontrolledState({defaultProp:e,onChange:n}),g=t!==void 0,b=g?t:l;{const S=React__namespace.useRef(t!==void 0);React__namespace.useEffect(()=>{const R=S.current;R!==g&&console.warn(`${o} is changing from ${R?"controlled":"uncontrolled"} to ${g?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),S.current=g},[g,o])}const _=React__namespace.useCallback(S=>{var R;if(g){const C=isFunction$6(S)?S(t):S;C!==t&&((R=f.current)==null||R.call(f,C))}else d(S)},[g,t,d,f]);return[b,_]}function useUncontrolledState({defaultProp:t,onChange:e}){const[n,o]=React__namespace.useState(t),l=React__namespace.useRef(n),d=React__namespace.useRef(e);return useInsertionEffect(()=>{d.current=e},[e]),React__namespace.useEffect(()=>{var f;l.current!==n&&((f=d.current)==null||f.call(d,n),l.current=n)},[n,l]),[n,o,d]}function isFunction$6(t){return typeof t=="function"}var DirectionContext=React__namespace.createContext(void 0);function useDirection(t){const e=React__namespace.useContext(DirectionContext);return t||e||"ltr"}var ENTRY_FOCUS="rovingFocusGroup.onEntryFocus",EVENT_OPTIONS$1={bubbles:!1,cancelable:!0},GROUP_NAME$3="RovingFocusGroup",[Collection$3,useCollection$3,createCollectionScope$3]=createCollection(GROUP_NAME$3),[createRovingFocusGroupContext,createRovingFocusGroupScope]=createContextScope(GROUP_NAME$3,[createCollectionScope$3]),[RovingFocusProvider,useRovingFocusContext]=createRovingFocusGroupContext(GROUP_NAME$3),RovingFocusGroup=React__namespace.forwardRef((t,e)=>jsxRuntime.jsx(Collection$3.Provider,{scope:t.__scopeRovingFocusGroup,children:jsxRuntime.jsx(Collection$3.Slot,{scope:t.__scopeRovingFocusGroup,children:jsxRuntime.jsx(RovingFocusGroupImpl,{...t,ref:e})})}));RovingFocusGroup.displayName=GROUP_NAME$3;var RovingFocusGroupImpl=React__namespace.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:l=!1,dir:d,currentTabStopId:f,defaultCurrentTabStopId:g,onCurrentTabStopIdChange:b,onEntryFocus:_,preventScrollOnEntryFocus:S=!1,...R}=t,C=React__namespace.useRef(null),E=useComposedRefs(e,C),A=useDirection(d),[M,I]=useControllableState({prop:f,defaultProp:g??null,onChange:b,caller:GROUP_NAME$3}),[j,q]=React__namespace.useState(!1),z=useCallbackRef$1(_),Q=useCollection$3(n),F=React__namespace.useRef(!1),[V,te]=React__namespace.useState(0);return React__namespace.useEffect(()=>{const ne=C.current;if(ne)return ne.addEventListener(ENTRY_FOCUS,z),()=>ne.removeEventListener(ENTRY_FOCUS,z)},[z]),jsxRuntime.jsx(RovingFocusProvider,{scope:n,orientation:o,dir:A,loop:l,currentTabStopId:M,onItemFocus:React__namespace.useCallback(ne=>I(ne),[I]),onItemShiftTab:React__namespace.useCallback(()=>q(!0),[]),onFocusableItemAdd:React__namespace.useCallback(()=>te(ne=>ne+1),[]),onFocusableItemRemove:React__namespace.useCallback(()=>te(ne=>ne-1),[]),children:jsxRuntime.jsx(Primitive.div,{tabIndex:j||V===0?-1:0,"data-orientation":o,...R,ref:E,style:{outline:"none",...t.style},onMouseDown:composeEventHandlers(t.onMouseDown,()=>{F.current=!0}),onFocus:composeEventHandlers(t.onFocus,ne=>{const se=!F.current;if(ne.target===ne.currentTarget&&se&&!j){const ge=new CustomEvent(ENTRY_FOCUS,EVENT_OPTIONS$1);if(ne.currentTarget.dispatchEvent(ge),!ge.defaultPrevented){const oe=Q().filter(Fe=>Fe.focusable),Ae=oe.find(Fe=>Fe.active),je=oe.find(Fe=>Fe.id===M),Oe=[Ae,je,...oe].filter(Boolean).map(Fe=>Fe.ref.current);focusFirst$3(Oe,S)}}F.current=!1}),onBlur:composeEventHandlers(t.onBlur,()=>q(!1))})})}),ITEM_NAME$4="RovingFocusGroupItem",RovingFocusGroupItem=React__namespace.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:l=!1,tabStopId:d,children:f,...g}=t,b=useId(),_=d||b,S=useRovingFocusContext(ITEM_NAME$4,n),R=S.currentTabStopId===_,C=useCollection$3(n),{onFocusableItemAdd:E,onFocusableItemRemove:A,currentTabStopId:M}=S;return React__namespace.useEffect(()=>{if(o)return E(),()=>A()},[o,E,A]),jsxRuntime.jsx(Collection$3.ItemSlot,{scope:n,id:_,focusable:o,active:l,children:jsxRuntime.jsx(Primitive.span,{tabIndex:R?0:-1,"data-orientation":S.orientation,...g,ref:e,onMouseDown:composeEventHandlers(t.onMouseDown,I=>{o?S.onItemFocus(_):I.preventDefault()}),onFocus:composeEventHandlers(t.onFocus,()=>S.onItemFocus(_)),onKeyDown:composeEventHandlers(t.onKeyDown,I=>{if(I.key==="Tab"&&I.shiftKey){S.onItemShiftTab();return}if(I.target!==I.currentTarget)return;const j=getFocusIntent(I,S.orientation,S.dir);if(j!==void 0){if(I.metaKey||I.ctrlKey||I.altKey||I.shiftKey)return;I.preventDefault();let z=C().filter(Q=>Q.focusable).map(Q=>Q.ref.current);if(j==="last")z.reverse();else if(j==="prev"||j==="next"){j==="prev"&&z.reverse();const Q=z.indexOf(I.currentTarget);z=S.loop?wrapArray$2(z,Q+1):z.slice(Q+1)}setTimeout(()=>focusFirst$3(z))}}),children:typeof f=="function"?f({isCurrentTabStop:R,hasTabStop:M!=null}):f})})});RovingFocusGroupItem.displayName=ITEM_NAME$4;var MAP_KEY_TO_FOCUS_INTENT={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function getDirectionAwareKey(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function getFocusIntent(t,e,n){const o=getDirectionAwareKey(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return MAP_KEY_TO_FOCUS_INTENT[o]}function focusFirst$3(t,e=!1){const n=document.activeElement;for(const o of t)if(o===n||(o.focus({preventScroll:e}),document.activeElement!==n))return}function wrapArray$2(t,e){return t.map((n,o)=>t[(e+o)%t.length])}var Root$a=RovingFocusGroup,Item$2=RovingFocusGroupItem;function useSize(t){const[e,n]=React__namespace.useState(void 0);return useLayoutEffect2(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const o=new ResizeObserver(l=>{if(!Array.isArray(l)||!l.length)return;const d=l[0];let f,g;if("borderBoxSize"in d){const b=d.borderBoxSize,_=Array.isArray(b)?b[0]:b;f=_.inlineSize,g=_.blockSize}else f=t.offsetWidth,g=t.offsetHeight;n({width:f,height:g})});return o.observe(t,{box:"border-box"}),()=>o.unobserve(t)}else n(void 0)},[t]),e}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])}function useStateMachine$1(t,e){return React__namespace.useReducer((n,o)=>e[n][o]??n,t)}var Presence=t=>{const{present:e,children:n}=t,o=usePresence(e),l=typeof n=="function"?n({present:o.isPresent}):React__namespace.Children.only(n),d=useComposedRefs(o.ref,getElementRef(l));return typeof n=="function"||o.isPresent?React__namespace.cloneElement(l,{ref:d}):null};Presence.displayName="Presence";function usePresence(t){const[e,n]=React__namespace.useState(),o=React__namespace.useRef(null),l=React__namespace.useRef(t),d=React__namespace.useRef("none"),f=t?"mounted":"unmounted",[g,b]=useStateMachine$1(f,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return React__namespace.useEffect(()=>{const _=getAnimationName(o.current);d.current=g==="mounted"?_:"none"},[g]),useLayoutEffect2(()=>{const _=o.current,S=l.current;if(S!==t){const C=d.current,E=getAnimationName(_);t?b("MOUNT"):E==="none"||(_==null?void 0:_.display)==="none"?b("UNMOUNT"):b(S&&C!==E?"ANIMATION_OUT":"UNMOUNT"),l.current=t}},[t,b]),useLayoutEffect2(()=>{if(e){let _;const S=e.ownerDocument.defaultView??window,R=E=>{const M=getAnimationName(o.current).includes(E.animationName);if(E.target===e&&M&&(b("ANIMATION_END"),!l.current)){const I=e.style.animationFillMode;e.style.animationFillMode="forwards",_=S.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=I)})}},C=E=>{E.target===e&&(d.current=getAnimationName(o.current))};return e.addEventListener("animationstart",C),e.addEventListener("animationcancel",R),e.addEventListener("animationend",R),()=>{S.clearTimeout(_),e.removeEventListener("animationstart",C),e.removeEventListener("animationcancel",R),e.removeEventListener("animationend",R)}}else b("ANIMATION_END")},[e,b]),{isPresent:["mounted","unmountSuspended"].includes(g),ref:React__namespace.useCallback(_=>{o.current=_?getComputedStyle(_):null,n(_)},[])}}function getAnimationName(t){return(t==null?void 0:t.animationName)||"none"}function getElementRef(t){var o,l;let e=(o=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(l=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:l.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var RADIO_NAME="Radio",[createRadioContext,createRadioScope]=createContextScope(RADIO_NAME),[RadioProvider,useRadioContext]=createRadioContext(RADIO_NAME),Radio=React__namespace.forwardRef((t,e)=>{const{__scopeRadio:n,name:o,checked:l=!1,required:d,disabled:f,value:g="on",onCheck:b,form:_,...S}=t,[R,C]=React__namespace.useState(null),E=useComposedRefs(e,I=>C(I)),A=React__namespace.useRef(!1),M=R?_||!!R.closest("form"):!0;return jsxRuntime.jsxs(RadioProvider,{scope:n,checked:l,disabled:f,children:[jsxRuntime.jsx(Primitive.button,{type:"button",role:"radio","aria-checked":l,"data-state":getState$4(l),"data-disabled":f?"":void 0,disabled:f,value:g,...S,ref:E,onClick:composeEventHandlers(t.onClick,I=>{l||b==null||b(),M&&(A.current=I.isPropagationStopped(),A.current||I.stopPropagation())})}),M&&jsxRuntime.jsx(RadioBubbleInput,{control:R,bubbles:!A.current,name:o,value:g,checked:l,required:d,disabled:f,form:_,style:{transform:"translateX(-100%)"}})]})});Radio.displayName=RADIO_NAME;var INDICATOR_NAME$3="RadioIndicator",RadioIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeRadio:n,forceMount:o,...l}=t,d=useRadioContext(INDICATOR_NAME$3,n);return jsxRuntime.jsx(Presence,{present:o||d.checked,children:jsxRuntime.jsx(Primitive.span,{"data-state":getState$4(d.checked),"data-disabled":d.disabled?"":void 0,...l,ref:e})})});RadioIndicator.displayName=INDICATOR_NAME$3;var BUBBLE_INPUT_NAME$3="RadioBubbleInput",RadioBubbleInput=React__namespace.forwardRef(({__scopeRadio:t,control:e,checked:n,bubbles:o=!0,...l},d)=>{const f=React__namespace.useRef(null),g=useComposedRefs(f,d),b=usePrevious(n),_=useSize(e);return React__namespace.useEffect(()=>{const S=f.current;if(!S)return;const R=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(R,"checked").set;if(b!==n&&E){const A=new Event("click",{bubbles:o});E.call(S,n),S.dispatchEvent(A)}},[b,n,o]),jsxRuntime.jsx(Primitive.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...l,tabIndex:-1,ref:g,style:{...l.style,..._,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});RadioBubbleInput.displayName=BUBBLE_INPUT_NAME$3;function getState$4(t){return t?"checked":"unchecked"}var ARROW_KEYS=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],RADIO_GROUP_NAME$2="RadioGroup",[createRadioGroupContext,createRadioGroupScope]=createContextScope(RADIO_GROUP_NAME$2,[createRovingFocusGroupScope,createRadioScope]),useRovingFocusGroupScope$2=createRovingFocusGroupScope(),useRadioScope=createRadioScope(),[RadioGroupProvider$1,useRadioGroupContext$1]=createRadioGroupContext(RADIO_GROUP_NAME$2),RadioGroup$2=React__namespace.forwardRef((t,e)=>{const{__scopeRadioGroup:n,name:o,defaultValue:l,value:d,required:f=!1,disabled:g=!1,orientation:b,dir:_,loop:S=!0,onValueChange:R,...C}=t,E=useRovingFocusGroupScope$2(n),A=useDirection(_),[M,I]=useControllableState({prop:d,defaultProp:l??null,onChange:R,caller:RADIO_GROUP_NAME$2});return jsxRuntime.jsx(RadioGroupProvider$1,{scope:n,name:o,required:f,disabled:g,value:M,onValueChange:I,children:jsxRuntime.jsx(Root$a,{asChild:!0,...E,orientation:b,dir:A,loop:S,children:jsxRuntime.jsx(Primitive.div,{role:"radiogroup","aria-required":f,"aria-orientation":b,"data-disabled":g?"":void 0,dir:A,...C,ref:e})})})});RadioGroup$2.displayName=RADIO_GROUP_NAME$2;var ITEM_NAME$3="RadioGroupItem",RadioGroupItem$1=React__namespace.forwardRef((t,e)=>{const{__scopeRadioGroup:n,disabled:o,...l}=t,d=useRadioGroupContext$1(ITEM_NAME$3,n),f=d.disabled||o,g=useRovingFocusGroupScope$2(n),b=useRadioScope(n),_=React__namespace.useRef(null),S=useComposedRefs(e,_),R=d.value===l.value,C=React__namespace.useRef(!1);return React__namespace.useEffect(()=>{const E=M=>{ARROW_KEYS.includes(M.key)&&(C.current=!0)},A=()=>C.current=!1;return document.addEventListener("keydown",E),document.addEventListener("keyup",A),()=>{document.removeEventListener("keydown",E),document.removeEventListener("keyup",A)}},[]),jsxRuntime.jsx(Item$2,{asChild:!0,...g,focusable:!f,active:R,children:jsxRuntime.jsx(Radio,{disabled:f,required:d.required,checked:R,...b,...l,name:d.name,ref:S,onCheck:()=>d.onValueChange(l.value),onKeyDown:composeEventHandlers(E=>{E.key==="Enter"&&E.preventDefault()}),onFocus:composeEventHandlers(l.onFocus,()=>{var E;C.current&&((E=_.current)==null||E.click())})})})});RadioGroupItem$1.displayName=ITEM_NAME$3;var INDICATOR_NAME2="RadioGroupIndicator",RadioGroupIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeRadioGroup:n,...o}=t,l=useRadioScope(n);return jsxRuntime.jsx(RadioIndicator,{...l,...o,ref:e})});RadioGroupIndicator.displayName=INDICATOR_NAME2;var Root2$7=RadioGroup$2,Item2$2=RadioGroupItem$1,Indicator$1=RadioGroupIndicator;const RadioGroup$1=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Root2$7,{className:cn("grid gap-2",t),...e,ref:n}));RadioGroup$1.displayName=Root2$7.displayName;const RadioGroupItem=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Item2$2,{ref:n,className:cn("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow-sm focus:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:jsxRuntime.jsx(Indicator$1,{className:"flex items-center justify-center",children:jsxRuntime.jsx(Circle,{className:"h-3.5 w-3.5 fill-primary"})})}));RadioGroupItem.displayName=Item2$2.displayName;function useEscapeKeydown(t,e=globalThis==null?void 0:globalThis.document){const n=useCallbackRef$1(t);React__namespace.useEffect(()=>{const o=l=>{l.key==="Escape"&&n(l)};return e.addEventListener("keydown",o,{capture:!0}),()=>e.removeEventListener("keydown",o,{capture:!0})},[n,e])}var DISMISSABLE_LAYER_NAME="DismissableLayer",CONTEXT_UPDATE="dismissableLayer.update",POINTER_DOWN_OUTSIDE="dismissableLayer.pointerDownOutside",FOCUS_OUTSIDE="dismissableLayer.focusOutside",originalBodyPointerEvents,DismissableLayerContext=React__namespace.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),DismissableLayer=React__namespace.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:f,onDismiss:g,...b}=t,_=React__namespace.useContext(DismissableLayerContext),[S,R]=React__namespace.useState(null),C=(S==null?void 0:S.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,E]=React__namespace.useState({}),A=useComposedRefs(e,te=>R(te)),M=Array.from(_.layers),[I]=[..._.layersWithOutsidePointerEventsDisabled].slice(-1),j=M.indexOf(I),q=S?M.indexOf(S):-1,z=_.layersWithOutsidePointerEventsDisabled.size>0,Q=q>=j,F=usePointerDownOutside(te=>{const ne=te.target,se=[..._.branches].some(ge=>ge.contains(ne));!Q||se||(l==null||l(te),f==null||f(te),te.defaultPrevented||g==null||g())},C),V=useFocusOutside(te=>{const ne=te.target;[..._.branches].some(ge=>ge.contains(ne))||(d==null||d(te),f==null||f(te),te.defaultPrevented||g==null||g())},C);return useEscapeKeydown(te=>{q===_.layers.size-1&&(o==null||o(te),!te.defaultPrevented&&g&&(te.preventDefault(),g()))},C),React__namespace.useEffect(()=>{if(S)return n&&(_.layersWithOutsidePointerEventsDisabled.size===0&&(originalBodyPointerEvents=C.body.style.pointerEvents,C.body.style.pointerEvents="none"),_.layersWithOutsidePointerEventsDisabled.add(S)),_.layers.add(S),dispatchUpdate(),()=>{n&&_.layersWithOutsidePointerEventsDisabled.size===1&&(C.body.style.pointerEvents=originalBodyPointerEvents)}},[S,C,n,_]),React__namespace.useEffect(()=>()=>{S&&(_.layers.delete(S),_.layersWithOutsidePointerEventsDisabled.delete(S),dispatchUpdate())},[S,_]),React__namespace.useEffect(()=>{const te=()=>E({});return document.addEventListener(CONTEXT_UPDATE,te),()=>document.removeEventListener(CONTEXT_UPDATE,te)},[]),jsxRuntime.jsx(Primitive.div,{...b,ref:A,style:{pointerEvents:z?Q?"auto":"none":void 0,...t.style},onFocusCapture:composeEventHandlers(t.onFocusCapture,V.onFocusCapture),onBlurCapture:composeEventHandlers(t.onBlurCapture,V.onBlurCapture),onPointerDownCapture:composeEventHandlers(t.onPointerDownCapture,F.onPointerDownCapture)})});DismissableLayer.displayName=DISMISSABLE_LAYER_NAME;var BRANCH_NAME="DismissableLayerBranch",DismissableLayerBranch=React__namespace.forwardRef((t,e)=>{const n=React__namespace.useContext(DismissableLayerContext),o=React__namespace.useRef(null),l=useComposedRefs(e,o);return React__namespace.useEffect(()=>{const d=o.current;if(d)return n.branches.add(d),()=>{n.branches.delete(d)}},[n.branches]),jsxRuntime.jsx(Primitive.div,{...t,ref:l})});DismissableLayerBranch.displayName=BRANCH_NAME;function usePointerDownOutside(t,e=globalThis==null?void 0:globalThis.document){const n=useCallbackRef$1(t),o=React__namespace.useRef(!1),l=React__namespace.useRef(()=>{});return React__namespace.useEffect(()=>{const d=g=>{if(g.target&&!o.current){let b=function(){handleAndDispatchCustomEvent$1(POINTER_DOWN_OUTSIDE,n,_,{discrete:!0})};const _={originalEvent:g};g.pointerType==="touch"?(e.removeEventListener("click",l.current),l.current=b,e.addEventListener("click",l.current,{once:!0})):b()}else e.removeEventListener("click",l.current);o.current=!1},f=window.setTimeout(()=>{e.addEventListener("pointerdown",d)},0);return()=>{window.clearTimeout(f),e.removeEventListener("pointerdown",d),e.removeEventListener("click",l.current)}},[e,n]),{onPointerDownCapture:()=>o.current=!0}}function useFocusOutside(t,e=globalThis==null?void 0:globalThis.document){const n=useCallbackRef$1(t),o=React__namespace.useRef(!1);return React__namespace.useEffect(()=>{const l=d=>{d.target&&!o.current&&handleAndDispatchCustomEvent$1(FOCUS_OUTSIDE,n,{originalEvent:d},{discrete:!1})};return e.addEventListener("focusin",l),()=>e.removeEventListener("focusin",l)},[e,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function dispatchUpdate(){const t=new CustomEvent(CONTEXT_UPDATE);document.dispatchEvent(t)}function handleAndDispatchCustomEvent$1(t,e,n,{discrete:o}){const l=n.originalEvent.target,d=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&l.addEventListener(t,e,{once:!0}),o?dispatchDiscreteCustomEvent(l,d):l.dispatchEvent(d)}var Root$9=DismissableLayer,Branch$1=DismissableLayerBranch,AUTOFOCUS_ON_MOUNT="focusScope.autoFocusOnMount",AUTOFOCUS_ON_UNMOUNT="focusScope.autoFocusOnUnmount",EVENT_OPTIONS={bubbles:!1,cancelable:!0},FOCUS_SCOPE_NAME="FocusScope",FocusScope=React__namespace.forwardRef((t,e)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:l,onUnmountAutoFocus:d,...f}=t,[g,b]=React__namespace.useState(null),_=useCallbackRef$1(l),S=useCallbackRef$1(d),R=React__namespace.useRef(null),C=useComposedRefs(e,M=>b(M)),E=React__namespace.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;React__namespace.useEffect(()=>{if(o){let M=function(z){if(E.paused||!g)return;const Q=z.target;g.contains(Q)?R.current=Q:focus$1(R.current,{select:!0})},I=function(z){if(E.paused||!g)return;const Q=z.relatedTarget;Q!==null&&(g.contains(Q)||focus$1(R.current,{select:!0}))},j=function(z){if(document.activeElement===document.body)for(const F of z)F.removedNodes.length>0&&focus$1(g)};document.addEventListener("focusin",M),document.addEventListener("focusout",I);const q=new MutationObserver(j);return g&&q.observe(g,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",M),document.removeEventListener("focusout",I),q.disconnect()}}},[o,g,E.paused]),React__namespace.useEffect(()=>{if(g){focusScopesStack.add(E);const M=document.activeElement;if(!g.contains(M)){const j=new CustomEvent(AUTOFOCUS_ON_MOUNT,EVENT_OPTIONS);g.addEventListener(AUTOFOCUS_ON_MOUNT,_),g.dispatchEvent(j),j.defaultPrevented||(focusFirst$2(removeLinks(getTabbableCandidates$1(g)),{select:!0}),document.activeElement===M&&focus$1(g))}return()=>{g.removeEventListener(AUTOFOCUS_ON_MOUNT,_),setTimeout(()=>{const j=new CustomEvent(AUTOFOCUS_ON_UNMOUNT,EVENT_OPTIONS);g.addEventListener(AUTOFOCUS_ON_UNMOUNT,S),g.dispatchEvent(j),j.defaultPrevented||focus$1(M??document.body,{select:!0}),g.removeEventListener(AUTOFOCUS_ON_UNMOUNT,S),focusScopesStack.remove(E)},0)}}},[g,_,S,E]);const A=React__namespace.useCallback(M=>{if(!n&&!o||E.paused)return;const I=M.key==="Tab"&&!M.altKey&&!M.ctrlKey&&!M.metaKey,j=document.activeElement;if(I&&j){const q=M.currentTarget,[z,Q]=getTabbableEdges(q);z&&Q?!M.shiftKey&&j===Q?(M.preventDefault(),n&&focus$1(z,{select:!0})):M.shiftKey&&j===z&&(M.preventDefault(),n&&focus$1(Q,{select:!0})):j===q&&M.preventDefault()}},[n,o,E.paused]);return jsxRuntime.jsx(Primitive.div,{tabIndex:-1,...f,ref:C,onKeyDown:A})});FocusScope.displayName=FOCUS_SCOPE_NAME;function focusFirst$2(t,{select:e=!1}={}){const n=document.activeElement;for(const o of t)if(focus$1(o,{select:e}),document.activeElement!==n)return}function getTabbableEdges(t){const e=getTabbableCandidates$1(t),n=findVisible(e,t),o=findVisible(e.reverse(),t);return[n,o]}function getTabbableCandidates$1(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const l=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||l?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function findVisible(t,e){for(const n of t)if(!isHidden(n,{upTo:e}))return n}function isHidden(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function isSelectableInput(t){return t instanceof HTMLInputElement&&"select"in t}function focus$1(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&isSelectableInput(t)&&e&&t.select()}}var focusScopesStack=createFocusScopesStack();function createFocusScopesStack(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=arrayRemove(t,e),t.unshift(e)},remove(e){var n;t=arrayRemove(t,e),(n=t[0])==null||n.resume()}}}function arrayRemove(t,e){const n=[...t],o=n.indexOf(e);return o!==-1&&n.splice(o,1),n}function removeLinks(t){return t.filter(e=>e.tagName!=="A")}var PORTAL_NAME$7="Portal",Portal$5=React__namespace.forwardRef((t,e)=>{var g;const{container:n,...o}=t,[l,d]=React__namespace.useState(!1);useLayoutEffect2(()=>d(!0),[]);const f=n||l&&((g=globalThis==null?void 0:globalThis.document)==null?void 0:g.body);return f?ReactDOM.createPortal(jsxRuntime.jsx(Primitive.div,{...o,ref:e}),f):null});Portal$5.displayName=PORTAL_NAME$7;var count$2=0;function useFocusGuards(){React__namespace.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??createFocusGuard()),document.body.insertAdjacentElement("beforeend",t[1]??createFocusGuard()),count$2++,()=>{count$2===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),count$2--}},[])}function createFocusGuard(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var __assign$1=function(){return __assign$1=Object.assign||function(e){for(var n,o=1,l=arguments.length;o<l;o++){n=arguments[o];for(var d in n)Object.prototype.hasOwnProperty.call(n,d)&&(e[d]=n[d])}return e},__assign$1.apply(this,arguments)};function __rest(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,o=Object.getOwnPropertySymbols(t);l<o.length;l++)e.indexOf(o[l])<0&&Object.prototype.propertyIsEnumerable.call(t,o[l])&&(n[o[l]]=t[o[l]]);return n}function __spreadArray(t,e,n){if(n||arguments.length===2)for(var o=0,l=e.length,d;o<l;o++)(d||!(o in e))&&(d||(d=Array.prototype.slice.call(e,0,o)),d[o]=e[o]);return t.concat(d||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;var zeroRightClassName="right-scroll-bar-position",fullWidthClassName="width-before-scroll-bar",noScrollbarsClassName="with-scroll-bars-hidden",removedBarSizeVariable="--removed-body-scroll-bar-size";function assignRef(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function useCallbackRef(t,e){var n=React.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(o){var l=n.value;l!==o&&(n.value=o,n.callback(o,l))}}}})[0];return n.callback=e,n.facade}var useIsomorphicLayoutEffect$3=typeof window<"u"?React__namespace.useLayoutEffect:React__namespace.useEffect,currentValues=new WeakMap;function useMergeRefs(t,e){var n=useCallbackRef(null,function(o){return t.forEach(function(l){return assignRef(l,o)})});return useIsomorphicLayoutEffect$3(function(){var o=currentValues.get(n);if(o){var l=new Set(o),d=new Set(t),f=n.current;l.forEach(function(g){d.has(g)||assignRef(g,null)}),d.forEach(function(g){l.has(g)||assignRef(g,f)})}currentValues.set(n,t)},[t]),n}function ItoI(t){return t}function innerCreateMedium(t,e){e===void 0&&(e=ItoI);var n=[],o=!1,l={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(d){var f=e(d,o);return n.push(f),function(){n=n.filter(function(g){return g!==f})}},assignSyncMedium:function(d){for(o=!0;n.length;){var f=n;n=[],f.forEach(d)}n={push:function(g){return d(g)},filter:function(){return n}}},assignMedium:function(d){o=!0;var f=[];if(n.length){var g=n;n=[],g.forEach(d),f=n}var b=function(){var S=f;f=[],S.forEach(d)},_=function(){return Promise.resolve().then(b)};_(),n={push:function(S){f.push(S),_()},filter:function(S){return f=f.filter(S),n}}}};return l}function createSidecarMedium(t){t===void 0&&(t={});var e=innerCreateMedium(null);return e.options=__assign$1({async:!0,ssr:!1},t),e}var SideCar$1=function(t){var e=t.sideCar,n=__rest(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=e.read();if(!o)throw new Error("Sidecar medium not found");return React__namespace.createElement(o,__assign$1({},n))};SideCar$1.isSideCarExport=!0;function exportSidecar(t,e){return t.useMedium(e),SideCar$1}var effectCar=createSidecarMedium(),nothing=function(){},RemoveScroll=React__namespace.forwardRef(function(t,e){var n=React__namespace.useRef(null),o=React__namespace.useState({onScrollCapture:nothing,onWheelCapture:nothing,onTouchMoveCapture:nothing}),l=o[0],d=o[1],f=t.forwardProps,g=t.children,b=t.className,_=t.removeScrollBar,S=t.enabled,R=t.shards,C=t.sideCar,E=t.noRelative,A=t.noIsolation,M=t.inert,I=t.allowPinchZoom,j=t.as,q=j===void 0?"div":j,z=t.gapMode,Q=__rest(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=C,V=useMergeRefs([n,e]),te=__assign$1(__assign$1({},Q),l);return React__namespace.createElement(React__namespace.Fragment,null,S&&React__namespace.createElement(F,{sideCar:effectCar,removeScrollBar:_,shards:R,noRelative:E,noIsolation:A,inert:M,setCallbacks:d,allowPinchZoom:!!I,lockRef:n,gapMode:z}),f?React__namespace.cloneElement(React__namespace.Children.only(g),__assign$1(__assign$1({},te),{ref:V})):React__namespace.createElement(q,__assign$1({},te,{className:b,ref:V}),g))});RemoveScroll.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},RemoveScroll.classNames={fullWidth:fullWidthClassName,zeroRight:zeroRightClassName};var getNonce=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function makeStyleTag(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=getNonce();return e&&t.setAttribute("nonce",e),t}function injectStyles(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function insertStyleTag(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var stylesheetSingleton=function(){var t=0,e=null;return{add:function(n){t==0&&(e=makeStyleTag())&&(injectStyles(e,n),insertStyleTag(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},styleHookSingleton=function(){var t=stylesheetSingleton();return function(e,n){React__namespace.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},styleSingleton=function(){var t=styleHookSingleton(),e=function(n){var o=n.styles,l=n.dynamic;return t(o,l),null};return e},zeroGap={left:0,top:0,right:0,gap:0},parse=function(t){return parseInt(t||"",10)||0},getOffset$1=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],o=e[t==="padding"?"paddingTop":"marginTop"],l=e[t==="padding"?"paddingRight":"marginRight"];return[parse(n),parse(o),parse(l)]},getGapWidth=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return zeroGap;var e=getOffset$1(t),n=document.documentElement.clientWidth,o=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,o-n+e[2]-e[0])}},Style=styleSingleton(),lockAttribute="data-scroll-locked",getStyles=function(t,e,n,o){var l=t.left,d=t.top,f=t.right,g=t.gap;return n===void 0&&(n="margin"),`
425
+ */const __iconNode=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],X$1=createLucideIcon("X",__iconNode);function r(t){var e,n,o="";if(typeof t=="string"||typeof t=="number")o+=t;else if(typeof t=="object")if(Array.isArray(t)){var l=t.length;for(e=0;e<l;e++)t[e]&&(n=r(t[e]))&&(o&&(o+=" "),o+=n)}else for(n in t)t[n]&&(o&&(o+=" "),o+=n);return o}function clsx(){for(var t,e,n=0,o="",l=arguments.length;n<l;n++)(t=arguments[n])&&(e=r(t))&&(o&&(o+=" "),o+=e);return o}const CLASS_PART_SEPARATOR="-",createClassGroupUtils=t=>{const e=createClassMap(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=t;return{getClassGroupId:f=>{const g=f.split(CLASS_PART_SEPARATOR);return g[0]===""&&g.length!==1&&g.shift(),getGroupRecursive(g,e)||getGroupIdForArbitraryProperty(f)},getConflictingClassGroupIds:(f,g)=>{const b=n[f]||[];return g&&o[f]?[...b,...o[f]]:b}}},getGroupRecursive=(t,e)=>{var f;if(t.length===0)return e.classGroupId;const n=t[0],o=e.nextPart.get(n),l=o?getGroupRecursive(t.slice(1),o):void 0;if(l)return l;if(e.validators.length===0)return;const d=t.join(CLASS_PART_SEPARATOR);return(f=e.validators.find(({validator:g})=>g(d)))==null?void 0:f.classGroupId},arbitraryPropertyRegex=/^\[(.+)\]$/,getGroupIdForArbitraryProperty=t=>{if(arbitraryPropertyRegex.test(t)){const e=arbitraryPropertyRegex.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},createClassMap=t=>{const{theme:e,classGroups:n}=t,o={nextPart:new Map,validators:[]};for(const l in n)processClassesRecursively(n[l],o,l,e);return o},processClassesRecursively=(t,e,n,o)=>{t.forEach(l=>{if(typeof l=="string"){const d=l===""?e:getPart(e,l);d.classGroupId=n;return}if(typeof l=="function"){if(isThemeGetter(l)){processClassesRecursively(l(o),e,n,o);return}e.validators.push({validator:l,classGroupId:n});return}Object.entries(l).forEach(([d,f])=>{processClassesRecursively(f,getPart(e,d),n,o)})})},getPart=(t,e)=>{let n=t;return e.split(CLASS_PART_SEPARATOR).forEach(o=>{n.nextPart.has(o)||n.nextPart.set(o,{nextPart:new Map,validators:[]}),n=n.nextPart.get(o)}),n},isThemeGetter=t=>t.isThemeGetter,createLruCache=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,o=new Map;const l=(d,f)=>{n.set(d,f),e++,e>t&&(e=0,o=n,n=new Map)};return{get(d){let f=n.get(d);if(f!==void 0)return f;if((f=o.get(d))!==void 0)return l(d,f),f},set(d,f){n.has(d)?n.set(d,f):l(d,f)}}},IMPORTANT_MODIFIER="!",MODIFIER_SEPARATOR=":",MODIFIER_SEPARATOR_LENGTH=MODIFIER_SEPARATOR.length,createParseClassName=t=>{const{prefix:e,experimentalParseClassName:n}=t;let o=l=>{const d=[];let f=0,g=0,b=0,_;for(let A=0;A<l.length;A++){let M=l[A];if(f===0&&g===0){if(M===MODIFIER_SEPARATOR){d.push(l.slice(b,A)),b=A+MODIFIER_SEPARATOR_LENGTH;continue}if(M==="/"){_=A;continue}}M==="["?f++:M==="]"?f--:M==="("?g++:M===")"&&g--}const S=d.length===0?l:l.substring(b),R=stripImportantModifier(S),C=R!==S,E=_&&_>b?_-b:void 0;return{modifiers:d,hasImportantModifier:C,baseClassName:R,maybePostfixModifierPosition:E}};if(e){const l=e+MODIFIER_SEPARATOR,d=o;o=f=>f.startsWith(l)?d(f.substring(l.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:f,maybePostfixModifierPosition:void 0}}if(n){const l=o;o=d=>n({className:d,parseClassName:l})}return o},stripImportantModifier=t=>t.endsWith(IMPORTANT_MODIFIER)?t.substring(0,t.length-1):t.startsWith(IMPORTANT_MODIFIER)?t.substring(1):t,createSortModifiers=t=>{const e=Object.fromEntries(t.orderSensitiveModifiers.map(o=>[o,!0]));return o=>{if(o.length<=1)return o;const l=[];let d=[];return o.forEach(f=>{f[0]==="["||e[f]?(l.push(...d.sort(),f),d=[]):d.push(f)}),l.push(...d.sort()),l}},createConfigUtils=t=>({cache:createLruCache(t.cacheSize),parseClassName:createParseClassName(t),sortModifiers:createSortModifiers(t),...createClassGroupUtils(t)}),SPLIT_CLASSES_REGEX=/\s+/,mergeClassList=(t,e)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:l,sortModifiers:d}=e,f=[],g=t.trim().split(SPLIT_CLASSES_REGEX);let b="";for(let _=g.length-1;_>=0;_-=1){const S=g[_],{isExternal:R,modifiers:C,hasImportantModifier:E,baseClassName:A,maybePostfixModifierPosition:M}=n(S);if(R){b=S+(b.length>0?" "+b:b);continue}let I=!!M,j=o(I?A.substring(0,M):A);if(!j){if(!I){b=S+(b.length>0?" "+b:b);continue}if(j=o(A),!j){b=S+(b.length>0?" "+b:b);continue}I=!1}const q=d(C).join(":"),z=E?q+IMPORTANT_MODIFIER:q,Q=z+j;if(f.includes(Q))continue;f.push(Q);const F=l(j,I);for(let V=0;V<F.length;++V){const te=F[V];f.push(z+te)}b=S+(b.length>0?" "+b:b)}return b};function twJoin(){let t=0,e,n,o="";for(;t<arguments.length;)(e=arguments[t++])&&(n=toValue(e))&&(o&&(o+=" "),o+=n);return o}const toValue=t=>{if(typeof t=="string")return t;let e,n="";for(let o=0;o<t.length;o++)t[o]&&(e=toValue(t[o]))&&(n&&(n+=" "),n+=e);return n};function createTailwindMerge(t,...e){let n,o,l,d=f;function f(b){const _=e.reduce((S,R)=>R(S),t());return n=createConfigUtils(_),o=n.cache.get,l=n.cache.set,d=g,g(b)}function g(b){const _=o(b);if(_)return _;const S=mergeClassList(b,n);return l(b,S),S}return function(){return d(twJoin.apply(null,arguments))}}const fromTheme=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},arbitraryValueRegex=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,arbitraryVariableRegex=/^\((?:(\w[\w-]*):)?(.+)\)$/i,fractionRegex=/^\d+\/\d+$/,tshirtUnitRegex=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,lengthUnitRegex=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,colorFunctionRegex=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,shadowRegex=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,imageRegex=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,isFraction=t=>fractionRegex.test(t),isNumber$4=t=>!!t&&!Number.isNaN(Number(t)),isInteger=t=>!!t&&Number.isInteger(Number(t)),isPercent$1=t=>t.endsWith("%")&&isNumber$4(t.slice(0,-1)),isTshirtSize=t=>tshirtUnitRegex.test(t),isAny=()=>!0,isLengthOnly=t=>lengthUnitRegex.test(t)&&!colorFunctionRegex.test(t),isNever=()=>!1,isShadow=t=>shadowRegex.test(t),isImage=t=>imageRegex.test(t),isAnyNonArbitrary=t=>!isArbitraryValue(t)&&!isArbitraryVariable(t),isArbitrarySize=t=>getIsArbitraryValue(t,isLabelSize,isNever),isArbitraryValue=t=>arbitraryValueRegex.test(t),isArbitraryLength=t=>getIsArbitraryValue(t,isLabelLength,isLengthOnly),isArbitraryNumber=t=>getIsArbitraryValue(t,isLabelNumber,isNumber$4),isArbitraryPosition=t=>getIsArbitraryValue(t,isLabelPosition,isNever),isArbitraryImage=t=>getIsArbitraryValue(t,isLabelImage,isImage),isArbitraryShadow=t=>getIsArbitraryValue(t,isLabelShadow,isShadow),isArbitraryVariable=t=>arbitraryVariableRegex.test(t),isArbitraryVariableLength=t=>getIsArbitraryVariable(t,isLabelLength),isArbitraryVariableFamilyName=t=>getIsArbitraryVariable(t,isLabelFamilyName),isArbitraryVariablePosition=t=>getIsArbitraryVariable(t,isLabelPosition),isArbitraryVariableSize=t=>getIsArbitraryVariable(t,isLabelSize),isArbitraryVariableImage=t=>getIsArbitraryVariable(t,isLabelImage),isArbitraryVariableShadow=t=>getIsArbitraryVariable(t,isLabelShadow,!0),getIsArbitraryValue=(t,e,n)=>{const o=arbitraryValueRegex.exec(t);return o?o[1]?e(o[1]):n(o[2]):!1},getIsArbitraryVariable=(t,e,n=!1)=>{const o=arbitraryVariableRegex.exec(t);return o?o[1]?e(o[1]):n:!1},isLabelPosition=t=>t==="position"||t==="percentage",isLabelImage=t=>t==="image"||t==="url",isLabelSize=t=>t==="length"||t==="size"||t==="bg-size",isLabelLength=t=>t==="length",isLabelNumber=t=>t==="number",isLabelFamilyName=t=>t==="family-name",isLabelShadow=t=>t==="shadow",getDefaultConfig=()=>{const t=fromTheme("color"),e=fromTheme("font"),n=fromTheme("text"),o=fromTheme("font-weight"),l=fromTheme("tracking"),d=fromTheme("leading"),f=fromTheme("breakpoint"),g=fromTheme("container"),b=fromTheme("spacing"),_=fromTheme("radius"),S=fromTheme("shadow"),R=fromTheme("inset-shadow"),C=fromTheme("text-shadow"),E=fromTheme("drop-shadow"),A=fromTheme("blur"),M=fromTheme("perspective"),I=fromTheme("aspect"),j=fromTheme("ease"),q=fromTheme("animate"),z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Q=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],F=()=>[...Q(),isArbitraryVariable,isArbitraryValue],V=()=>["auto","hidden","clip","visible","scroll"],te=()=>["auto","contain","none"],ne=()=>[isArbitraryVariable,isArbitraryValue,b],se=()=>[isFraction,"full","auto",...ne()],ge=()=>[isInteger,"none","subgrid",isArbitraryVariable,isArbitraryValue],oe=()=>["auto",{span:["full",isInteger,isArbitraryVariable,isArbitraryValue]},isInteger,isArbitraryVariable,isArbitraryValue],Ae=()=>[isInteger,"auto",isArbitraryVariable,isArbitraryValue],je=()=>["auto","min","max","fr",isArbitraryVariable,isArbitraryValue],Ne=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Oe=()=>["start","end","center","stretch","center-safe","end-safe"],Fe=()=>["auto",...ne()],ze=()=>[isFraction,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...ne()],$e=()=>[t,isArbitraryVariable,isArbitraryValue],Be=()=>[...Q(),isArbitraryVariablePosition,isArbitraryPosition,{position:[isArbitraryVariable,isArbitraryValue]}],qe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Ge=()=>["auto","cover","contain",isArbitraryVariableSize,isArbitrarySize,{size:[isArbitraryVariable,isArbitraryValue]}],He=()=>[isPercent$1,isArbitraryVariableLength,isArbitraryLength],Ze=()=>["","none","full",_,isArbitraryVariable,isArbitraryValue],tt=()=>["",isNumber$4,isArbitraryVariableLength,isArbitraryLength],Ye=()=>["solid","dashed","dotted","double"],Qe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Xe=()=>[isNumber$4,isPercent$1,isArbitraryVariablePosition,isArbitraryPosition],st=()=>["","none",A,isArbitraryVariable,isArbitraryValue],rt=()=>["none",isNumber$4,isArbitraryVariable,isArbitraryValue],at=()=>["none",isNumber$4,isArbitraryVariable,isArbitraryValue],ot=()=>[isNumber$4,isArbitraryVariable,isArbitraryValue],Ue=()=>[isFraction,"full",...ne()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[isTshirtSize],breakpoint:[isTshirtSize],color:[isAny],container:[isTshirtSize],"drop-shadow":[isTshirtSize],ease:["in","out","in-out"],font:[isAnyNonArbitrary],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[isTshirtSize],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[isTshirtSize],shadow:[isTshirtSize],spacing:["px",isNumber$4],text:[isTshirtSize],"text-shadow":[isTshirtSize],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",isFraction,isArbitraryValue,isArbitraryVariable,I]}],container:["container"],columns:[{columns:[isNumber$4,isArbitraryValue,isArbitraryVariable,g]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:F()}],overflow:[{overflow:V()}],"overflow-x":[{"overflow-x":V()}],"overflow-y":[{"overflow-y":V()}],overscroll:[{overscroll:te()}],"overscroll-x":[{"overscroll-x":te()}],"overscroll-y":[{"overscroll-y":te()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:se()}],"inset-x":[{"inset-x":se()}],"inset-y":[{"inset-y":se()}],start:[{start:se()}],end:[{end:se()}],top:[{top:se()}],right:[{right:se()}],bottom:[{bottom:se()}],left:[{left:se()}],visibility:["visible","invisible","collapse"],z:[{z:[isInteger,"auto",isArbitraryVariable,isArbitraryValue]}],basis:[{basis:[isFraction,"full","auto",g,...ne()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[isNumber$4,isFraction,"auto","initial","none",isArbitraryValue]}],grow:[{grow:["",isNumber$4,isArbitraryVariable,isArbitraryValue]}],shrink:[{shrink:["",isNumber$4,isArbitraryVariable,isArbitraryValue]}],order:[{order:[isInteger,"first","last","none",isArbitraryVariable,isArbitraryValue]}],"grid-cols":[{"grid-cols":ge()}],"col-start-end":[{col:oe()}],"col-start":[{"col-start":Ae()}],"col-end":[{"col-end":Ae()}],"grid-rows":[{"grid-rows":ge()}],"row-start-end":[{row:oe()}],"row-start":[{"row-start":Ae()}],"row-end":[{"row-end":Ae()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":je()}],"auto-rows":[{"auto-rows":je()}],gap:[{gap:ne()}],"gap-x":[{"gap-x":ne()}],"gap-y":[{"gap-y":ne()}],"justify-content":[{justify:[...Ne(),"normal"]}],"justify-items":[{"justify-items":[...Oe(),"normal"]}],"justify-self":[{"justify-self":["auto",...Oe()]}],"align-content":[{content:["normal",...Ne()]}],"align-items":[{items:[...Oe(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Oe(),{baseline:["","last"]}]}],"place-content":[{"place-content":Ne()}],"place-items":[{"place-items":[...Oe(),"baseline"]}],"place-self":[{"place-self":["auto",...Oe()]}],p:[{p:ne()}],px:[{px:ne()}],py:[{py:ne()}],ps:[{ps:ne()}],pe:[{pe:ne()}],pt:[{pt:ne()}],pr:[{pr:ne()}],pb:[{pb:ne()}],pl:[{pl:ne()}],m:[{m:Fe()}],mx:[{mx:Fe()}],my:[{my:Fe()}],ms:[{ms:Fe()}],me:[{me:Fe()}],mt:[{mt:Fe()}],mr:[{mr:Fe()}],mb:[{mb:Fe()}],ml:[{ml:Fe()}],"space-x":[{"space-x":ne()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":ne()}],"space-y-reverse":["space-y-reverse"],size:[{size:ze()}],w:[{w:[g,"screen",...ze()]}],"min-w":[{"min-w":[g,"screen","none",...ze()]}],"max-w":[{"max-w":[g,"screen","none","prose",{screen:[f]},...ze()]}],h:[{h:["screen","lh",...ze()]}],"min-h":[{"min-h":["screen","lh","none",...ze()]}],"max-h":[{"max-h":["screen","lh",...ze()]}],"font-size":[{text:["base",n,isArbitraryVariableLength,isArbitraryLength]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,isArbitraryVariable,isArbitraryNumber]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",isPercent$1,isArbitraryValue]}],"font-family":[{font:[isArbitraryVariableFamilyName,isArbitraryValue,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[l,isArbitraryVariable,isArbitraryValue]}],"line-clamp":[{"line-clamp":[isNumber$4,"none",isArbitraryVariable,isArbitraryNumber]}],leading:[{leading:[d,...ne()]}],"list-image":[{"list-image":["none",isArbitraryVariable,isArbitraryValue]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",isArbitraryVariable,isArbitraryValue]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:$e()}],"text-color":[{text:$e()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ye(),"wavy"]}],"text-decoration-thickness":[{decoration:[isNumber$4,"from-font","auto",isArbitraryVariable,isArbitraryLength]}],"text-decoration-color":[{decoration:$e()}],"underline-offset":[{"underline-offset":[isNumber$4,"auto",isArbitraryVariable,isArbitraryValue]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:ne()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",isArbitraryVariable,isArbitraryValue]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",isArbitraryVariable,isArbitraryValue]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Be()}],"bg-repeat":[{bg:qe()}],"bg-size":[{bg:Ge()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},isInteger,isArbitraryVariable,isArbitraryValue],radial:["",isArbitraryVariable,isArbitraryValue],conic:[isInteger,isArbitraryVariable,isArbitraryValue]},isArbitraryVariableImage,isArbitraryImage]}],"bg-color":[{bg:$e()}],"gradient-from-pos":[{from:He()}],"gradient-via-pos":[{via:He()}],"gradient-to-pos":[{to:He()}],"gradient-from":[{from:$e()}],"gradient-via":[{via:$e()}],"gradient-to":[{to:$e()}],rounded:[{rounded:Ze()}],"rounded-s":[{"rounded-s":Ze()}],"rounded-e":[{"rounded-e":Ze()}],"rounded-t":[{"rounded-t":Ze()}],"rounded-r":[{"rounded-r":Ze()}],"rounded-b":[{"rounded-b":Ze()}],"rounded-l":[{"rounded-l":Ze()}],"rounded-ss":[{"rounded-ss":Ze()}],"rounded-se":[{"rounded-se":Ze()}],"rounded-ee":[{"rounded-ee":Ze()}],"rounded-es":[{"rounded-es":Ze()}],"rounded-tl":[{"rounded-tl":Ze()}],"rounded-tr":[{"rounded-tr":Ze()}],"rounded-br":[{"rounded-br":Ze()}],"rounded-bl":[{"rounded-bl":Ze()}],"border-w":[{border:tt()}],"border-w-x":[{"border-x":tt()}],"border-w-y":[{"border-y":tt()}],"border-w-s":[{"border-s":tt()}],"border-w-e":[{"border-e":tt()}],"border-w-t":[{"border-t":tt()}],"border-w-r":[{"border-r":tt()}],"border-w-b":[{"border-b":tt()}],"border-w-l":[{"border-l":tt()}],"divide-x":[{"divide-x":tt()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":tt()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ye(),"hidden","none"]}],"divide-style":[{divide:[...Ye(),"hidden","none"]}],"border-color":[{border:$e()}],"border-color-x":[{"border-x":$e()}],"border-color-y":[{"border-y":$e()}],"border-color-s":[{"border-s":$e()}],"border-color-e":[{"border-e":$e()}],"border-color-t":[{"border-t":$e()}],"border-color-r":[{"border-r":$e()}],"border-color-b":[{"border-b":$e()}],"border-color-l":[{"border-l":$e()}],"divide-color":[{divide:$e()}],"outline-style":[{outline:[...Ye(),"none","hidden"]}],"outline-offset":[{"outline-offset":[isNumber$4,isArbitraryVariable,isArbitraryValue]}],"outline-w":[{outline:["",isNumber$4,isArbitraryVariableLength,isArbitraryLength]}],"outline-color":[{outline:$e()}],shadow:[{shadow:["","none",S,isArbitraryVariableShadow,isArbitraryShadow]}],"shadow-color":[{shadow:$e()}],"inset-shadow":[{"inset-shadow":["none",R,isArbitraryVariableShadow,isArbitraryShadow]}],"inset-shadow-color":[{"inset-shadow":$e()}],"ring-w":[{ring:tt()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$e()}],"ring-offset-w":[{"ring-offset":[isNumber$4,isArbitraryLength]}],"ring-offset-color":[{"ring-offset":$e()}],"inset-ring-w":[{"inset-ring":tt()}],"inset-ring-color":[{"inset-ring":$e()}],"text-shadow":[{"text-shadow":["none",C,isArbitraryVariableShadow,isArbitraryShadow]}],"text-shadow-color":[{"text-shadow":$e()}],opacity:[{opacity:[isNumber$4,isArbitraryVariable,isArbitraryValue]}],"mix-blend":[{"mix-blend":[...Qe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Qe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[isNumber$4]}],"mask-image-linear-from-pos":[{"mask-linear-from":Xe()}],"mask-image-linear-to-pos":[{"mask-linear-to":Xe()}],"mask-image-linear-from-color":[{"mask-linear-from":$e()}],"mask-image-linear-to-color":[{"mask-linear-to":$e()}],"mask-image-t-from-pos":[{"mask-t-from":Xe()}],"mask-image-t-to-pos":[{"mask-t-to":Xe()}],"mask-image-t-from-color":[{"mask-t-from":$e()}],"mask-image-t-to-color":[{"mask-t-to":$e()}],"mask-image-r-from-pos":[{"mask-r-from":Xe()}],"mask-image-r-to-pos":[{"mask-r-to":Xe()}],"mask-image-r-from-color":[{"mask-r-from":$e()}],"mask-image-r-to-color":[{"mask-r-to":$e()}],"mask-image-b-from-pos":[{"mask-b-from":Xe()}],"mask-image-b-to-pos":[{"mask-b-to":Xe()}],"mask-image-b-from-color":[{"mask-b-from":$e()}],"mask-image-b-to-color":[{"mask-b-to":$e()}],"mask-image-l-from-pos":[{"mask-l-from":Xe()}],"mask-image-l-to-pos":[{"mask-l-to":Xe()}],"mask-image-l-from-color":[{"mask-l-from":$e()}],"mask-image-l-to-color":[{"mask-l-to":$e()}],"mask-image-x-from-pos":[{"mask-x-from":Xe()}],"mask-image-x-to-pos":[{"mask-x-to":Xe()}],"mask-image-x-from-color":[{"mask-x-from":$e()}],"mask-image-x-to-color":[{"mask-x-to":$e()}],"mask-image-y-from-pos":[{"mask-y-from":Xe()}],"mask-image-y-to-pos":[{"mask-y-to":Xe()}],"mask-image-y-from-color":[{"mask-y-from":$e()}],"mask-image-y-to-color":[{"mask-y-to":$e()}],"mask-image-radial":[{"mask-radial":[isArbitraryVariable,isArbitraryValue]}],"mask-image-radial-from-pos":[{"mask-radial-from":Xe()}],"mask-image-radial-to-pos":[{"mask-radial-to":Xe()}],"mask-image-radial-from-color":[{"mask-radial-from":$e()}],"mask-image-radial-to-color":[{"mask-radial-to":$e()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":Q()}],"mask-image-conic-pos":[{"mask-conic":[isNumber$4]}],"mask-image-conic-from-pos":[{"mask-conic-from":Xe()}],"mask-image-conic-to-pos":[{"mask-conic-to":Xe()}],"mask-image-conic-from-color":[{"mask-conic-from":$e()}],"mask-image-conic-to-color":[{"mask-conic-to":$e()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Be()}],"mask-repeat":[{mask:qe()}],"mask-size":[{mask:Ge()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",isArbitraryVariable,isArbitraryValue]}],filter:[{filter:["","none",isArbitraryVariable,isArbitraryValue]}],blur:[{blur:st()}],brightness:[{brightness:[isNumber$4,isArbitraryVariable,isArbitraryValue]}],contrast:[{contrast:[isNumber$4,isArbitraryVariable,isArbitraryValue]}],"drop-shadow":[{"drop-shadow":["","none",E,isArbitraryVariableShadow,isArbitraryShadow]}],"drop-shadow-color":[{"drop-shadow":$e()}],grayscale:[{grayscale:["",isNumber$4,isArbitraryVariable,isArbitraryValue]}],"hue-rotate":[{"hue-rotate":[isNumber$4,isArbitraryVariable,isArbitraryValue]}],invert:[{invert:["",isNumber$4,isArbitraryVariable,isArbitraryValue]}],saturate:[{saturate:[isNumber$4,isArbitraryVariable,isArbitraryValue]}],sepia:[{sepia:["",isNumber$4,isArbitraryVariable,isArbitraryValue]}],"backdrop-filter":[{"backdrop-filter":["","none",isArbitraryVariable,isArbitraryValue]}],"backdrop-blur":[{"backdrop-blur":st()}],"backdrop-brightness":[{"backdrop-brightness":[isNumber$4,isArbitraryVariable,isArbitraryValue]}],"backdrop-contrast":[{"backdrop-contrast":[isNumber$4,isArbitraryVariable,isArbitraryValue]}],"backdrop-grayscale":[{"backdrop-grayscale":["",isNumber$4,isArbitraryVariable,isArbitraryValue]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[isNumber$4,isArbitraryVariable,isArbitraryValue]}],"backdrop-invert":[{"backdrop-invert":["",isNumber$4,isArbitraryVariable,isArbitraryValue]}],"backdrop-opacity":[{"backdrop-opacity":[isNumber$4,isArbitraryVariable,isArbitraryValue]}],"backdrop-saturate":[{"backdrop-saturate":[isNumber$4,isArbitraryVariable,isArbitraryValue]}],"backdrop-sepia":[{"backdrop-sepia":["",isNumber$4,isArbitraryVariable,isArbitraryValue]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":ne()}],"border-spacing-x":[{"border-spacing-x":ne()}],"border-spacing-y":[{"border-spacing-y":ne()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",isArbitraryVariable,isArbitraryValue]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[isNumber$4,"initial",isArbitraryVariable,isArbitraryValue]}],ease:[{ease:["linear","initial",j,isArbitraryVariable,isArbitraryValue]}],delay:[{delay:[isNumber$4,isArbitraryVariable,isArbitraryValue]}],animate:[{animate:["none",q,isArbitraryVariable,isArbitraryValue]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[M,isArbitraryVariable,isArbitraryValue]}],"perspective-origin":[{"perspective-origin":F()}],rotate:[{rotate:rt()}],"rotate-x":[{"rotate-x":rt()}],"rotate-y":[{"rotate-y":rt()}],"rotate-z":[{"rotate-z":rt()}],scale:[{scale:at()}],"scale-x":[{"scale-x":at()}],"scale-y":[{"scale-y":at()}],"scale-z":[{"scale-z":at()}],"scale-3d":["scale-3d"],skew:[{skew:ot()}],"skew-x":[{"skew-x":ot()}],"skew-y":[{"skew-y":ot()}],transform:[{transform:[isArbitraryVariable,isArbitraryValue,"","none","gpu","cpu"]}],"transform-origin":[{origin:F()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ue()}],"translate-x":[{"translate-x":Ue()}],"translate-y":[{"translate-y":Ue()}],"translate-z":[{"translate-z":Ue()}],"translate-none":["translate-none"],accent:[{accent:$e()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:$e()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",isArbitraryVariable,isArbitraryValue]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ne()}],"scroll-mx":[{"scroll-mx":ne()}],"scroll-my":[{"scroll-my":ne()}],"scroll-ms":[{"scroll-ms":ne()}],"scroll-me":[{"scroll-me":ne()}],"scroll-mt":[{"scroll-mt":ne()}],"scroll-mr":[{"scroll-mr":ne()}],"scroll-mb":[{"scroll-mb":ne()}],"scroll-ml":[{"scroll-ml":ne()}],"scroll-p":[{"scroll-p":ne()}],"scroll-px":[{"scroll-px":ne()}],"scroll-py":[{"scroll-py":ne()}],"scroll-ps":[{"scroll-ps":ne()}],"scroll-pe":[{"scroll-pe":ne()}],"scroll-pt":[{"scroll-pt":ne()}],"scroll-pr":[{"scroll-pr":ne()}],"scroll-pb":[{"scroll-pb":ne()}],"scroll-pl":[{"scroll-pl":ne()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",isArbitraryVariable,isArbitraryValue]}],fill:[{fill:["none",...$e()]}],"stroke-w":[{stroke:[isNumber$4,isArbitraryVariableLength,isArbitraryLength,isArbitraryNumber]}],stroke:[{stroke:["none",...$e()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},twMerge=createTailwindMerge(getDefaultConfig);function cn(...t){return twMerge(clsx(t))}const formatNumber=(t,e)=>new Intl.NumberFormat("en-CA",e).format(t),formatMoney=(t,e)=>{const n={style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:2,...e};return new Intl.NumberFormat("en-CA",n).format(t)},formatYYYYMMDDIntToDateString=t=>{if(t===null||typeof t>"u")return"—";const e=t.toString();if(e.length===8){const n=e.substring(0,4),o=e.substring(4,6),l=e.substring(6,8);return`${n}-${o}-${l}`}return e};function InputOTP({className:t,containerClassName:e,...n}){return jsxRuntime.jsx(Lt,{"data-slot":"input-otp",containerClassName:cn("flex items-center gap-2 has-disabled:opacity-50",e),className:cn("disabled:cursor-not-allowed",t),...n})}function InputOTPGroup({className:t,...e}){return jsxRuntime.jsx("div",{"data-slot":"input-otp-group",className:cn("flex items-center",t),...e})}function InputOTPSlot({index:t,className:e,...n}){const o=React__namespace.useContext(jt),{char:l,hasFakeCaret:d,isActive:f}=(o==null?void 0:o.slots[t])??{};return jsxRuntime.jsxs("div",{"data-slot":"input-otp-slot","data-active":f,className:cn("border-input data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",e),...n,children:[l,d&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"animate-caret-blink bg-foreground h-4 w-px duration-1000"})})]})}function InputOTPSeparator({...t}){return jsxRuntime.jsx("div",{"data-slot":"input-otp-separator",role:"separator",...t,children:jsxRuntime.jsx(Minus,{})})}function composeEventHandlers(t,e,{checkForDefaultPrevented:n=!0}={}){return function(l){if(t==null||t(l),n===!1||!l.defaultPrevented)return e==null?void 0:e(l)}}function setRef(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function composeRefs(...t){return e=>{let n=!1;const o=t.map(l=>{const d=setRef(l,e);return!n&&typeof d=="function"&&(n=!0),d});if(n)return()=>{for(let l=0;l<o.length;l++){const d=o[l];typeof d=="function"?d():setRef(t[l],null)}}}}function useComposedRefs(...t){return React__namespace.useCallback(composeRefs(...t),t)}function createContext2(t,e){const n=React__namespace.createContext(e),o=d=>{const{children:f,...g}=d,b=React__namespace.useMemo(()=>g,Object.values(g));return jsxRuntime.jsx(n.Provider,{value:b,children:f})};o.displayName=t+"Provider";function l(d){const f=React__namespace.useContext(n);if(f)return f;if(e!==void 0)return e;throw new Error(`\`${d}\` must be used within \`${t}\``)}return[o,l]}function createContextScope(t,e=[]){let n=[];function o(d,f){const g=React__namespace.createContext(f),b=n.length;n=[...n,f];const _=R=>{var j;const{scope:C,children:E,...A}=R,M=((j=C==null?void 0:C[t])==null?void 0:j[b])||g,I=React__namespace.useMemo(()=>A,Object.values(A));return jsxRuntime.jsx(M.Provider,{value:I,children:E})};_.displayName=d+"Provider";function S(R,C){var M;const E=((M=C==null?void 0:C[t])==null?void 0:M[b])||g,A=React__namespace.useContext(E);if(A)return A;if(f!==void 0)return f;throw new Error(`\`${R}\` must be used within \`${d}\``)}return[_,S]}const l=()=>{const d=n.map(f=>React__namespace.createContext(f));return function(g){const b=(g==null?void 0:g[t])||d;return React__namespace.useMemo(()=>({[`__scope${t}`]:{...g,[t]:b}}),[g,b])}};return l.scopeName=t,[o,composeContextScopes(l,...e)]}function composeContextScopes(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const o=t.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(d){const f=o.reduce((g,{useScope:b,scopeName:_})=>{const R=b(d)[`__scope${_}`];return{...g,...R}},{});return React__namespace.useMemo(()=>({[`__scope${e.scopeName}`]:f}),[f])}};return n.scopeName=e.scopeName,n}function createSlot(t){const e=createSlotClone(t),n=React__namespace.forwardRef((o,l)=>{const{children:d,...f}=o,g=React__namespace.Children.toArray(d),b=g.find(isSlottable);if(b){const _=b.props.children,S=g.map(R=>R===b?React__namespace.Children.count(_)>1?React__namespace.Children.only(null):React__namespace.isValidElement(_)?_.props.children:null:R);return jsxRuntime.jsx(e,{...f,ref:l,children:React__namespace.isValidElement(_)?React__namespace.cloneElement(_,void 0,S):null})}return jsxRuntime.jsx(e,{...f,ref:l,children:d})});return n.displayName=`${t}.Slot`,n}var Slot$4=createSlot("Slot");function createSlotClone(t){const e=React__namespace.forwardRef((n,o)=>{const{children:l,...d}=n;if(React__namespace.isValidElement(l)){const f=getElementRef$1(l),g=mergeProps(d,l.props);return l.type!==React__namespace.Fragment&&(g.ref=o?composeRefs(o,f):f),React__namespace.cloneElement(l,g)}return React__namespace.Children.count(l)>1?React__namespace.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var SLOTTABLE_IDENTIFIER=Symbol("radix.slottable");function createSlottable(t){const e=({children:n})=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=SLOTTABLE_IDENTIFIER,e}function isSlottable(t){return React__namespace.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===SLOTTABLE_IDENTIFIER}function mergeProps(t,e){const n={...e};for(const o in e){const l=t[o],d=e[o];/^on[A-Z]/.test(o)?l&&d?n[o]=(...g)=>{const b=d(...g);return l(...g),b}:l&&(n[o]=l):o==="style"?n[o]={...l,...d}:o==="className"&&(n[o]=[l,d].filter(Boolean).join(" "))}return{...t,...n}}function getElementRef$1(t){var o,l;let e=(o=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(l=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:l.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var NODES=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Primitive=NODES.reduce((t,e)=>{const n=createSlot(`Primitive.${e}`),o=React__namespace.forwardRef((l,d)=>{const{asChild:f,...g}=l,b=f?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),jsxRuntime.jsx(b,{...g,ref:d})});return o.displayName=`Primitive.${e}`,{...t,[e]:o}},{});function dispatchDiscreteCustomEvent(t,e){t&&ReactDOM__namespace.flushSync(()=>t.dispatchEvent(e))}function createCollection(t){const e=t+"CollectionProvider",[n,o]=createContextScope(e),[l,d]=n(e,{collectionRef:{current:null},itemMap:new Map}),f=M=>{const{scope:I,children:j}=M,q=React.useRef(null),z=React.useRef(new Map).current;return jsxRuntime.jsx(l,{scope:I,itemMap:z,collectionRef:q,children:j})};f.displayName=e;const g=t+"CollectionSlot",b=createSlot(g),_=React.forwardRef((M,I)=>{const{scope:j,children:q}=M,z=d(g,j),Q=useComposedRefs(I,z.collectionRef);return jsxRuntime.jsx(b,{ref:Q,children:q})});_.displayName=g;const S=t+"CollectionItemSlot",R="data-radix-collection-item",C=createSlot(S),E=React.forwardRef((M,I)=>{const{scope:j,children:q,...z}=M,Q=React.useRef(null),F=useComposedRefs(I,Q),V=d(S,j);return React.useEffect(()=>(V.itemMap.set(Q,{ref:Q,...z}),()=>void V.itemMap.delete(Q))),jsxRuntime.jsx(C,{[R]:"",ref:F,children:q})});E.displayName=S;function A(M){const I=d(t+"CollectionConsumer",M);return React.useCallback(()=>{const q=I.collectionRef.current;if(!q)return[];const z=Array.from(q.querySelectorAll(`[${R}]`));return Array.from(I.itemMap.values()).sort((V,te)=>z.indexOf(V.ref.current)-z.indexOf(te.ref.current))},[I.collectionRef,I.itemMap])}return[{Provider:f,Slot:_,ItemSlot:E},A,o]}var useLayoutEffect2=globalThis!=null&&globalThis.document?React__namespace.useLayoutEffect:()=>{},useReactId=React__namespace[" useId ".trim().toString()]||(()=>{}),count$3=0;function useId(t){const[e,n]=React__namespace.useState(useReactId());return useLayoutEffect2(()=>{n(o=>o??String(count$3++))},[t]),e?`radix-${e}`:""}function useCallbackRef$1(t){const e=React__namespace.useRef(t);return React__namespace.useEffect(()=>{e.current=t}),React__namespace.useMemo(()=>(...n)=>{var o;return(o=e.current)==null?void 0:o.call(e,...n)},[])}var useInsertionEffect=React__namespace[" useInsertionEffect ".trim().toString()]||useLayoutEffect2;function useControllableState({prop:t,defaultProp:e,onChange:n=()=>{},caller:o}){const[l,d,f]=useUncontrolledState({defaultProp:e,onChange:n}),g=t!==void 0,b=g?t:l;{const S=React__namespace.useRef(t!==void 0);React__namespace.useEffect(()=>{const R=S.current;R!==g&&console.warn(`${o} is changing from ${R?"controlled":"uncontrolled"} to ${g?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),S.current=g},[g,o])}const _=React__namespace.useCallback(S=>{var R;if(g){const C=isFunction$6(S)?S(t):S;C!==t&&((R=f.current)==null||R.call(f,C))}else d(S)},[g,t,d,f]);return[b,_]}function useUncontrolledState({defaultProp:t,onChange:e}){const[n,o]=React__namespace.useState(t),l=React__namespace.useRef(n),d=React__namespace.useRef(e);return useInsertionEffect(()=>{d.current=e},[e]),React__namespace.useEffect(()=>{var f;l.current!==n&&((f=d.current)==null||f.call(d,n),l.current=n)},[n,l]),[n,o,d]}function isFunction$6(t){return typeof t=="function"}var DirectionContext=React__namespace.createContext(void 0);function useDirection(t){const e=React__namespace.useContext(DirectionContext);return t||e||"ltr"}var ENTRY_FOCUS="rovingFocusGroup.onEntryFocus",EVENT_OPTIONS$1={bubbles:!1,cancelable:!0},GROUP_NAME$3="RovingFocusGroup",[Collection$3,useCollection$3,createCollectionScope$3]=createCollection(GROUP_NAME$3),[createRovingFocusGroupContext,createRovingFocusGroupScope]=createContextScope(GROUP_NAME$3,[createCollectionScope$3]),[RovingFocusProvider,useRovingFocusContext]=createRovingFocusGroupContext(GROUP_NAME$3),RovingFocusGroup=React__namespace.forwardRef((t,e)=>jsxRuntime.jsx(Collection$3.Provider,{scope:t.__scopeRovingFocusGroup,children:jsxRuntime.jsx(Collection$3.Slot,{scope:t.__scopeRovingFocusGroup,children:jsxRuntime.jsx(RovingFocusGroupImpl,{...t,ref:e})})}));RovingFocusGroup.displayName=GROUP_NAME$3;var RovingFocusGroupImpl=React__namespace.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:l=!1,dir:d,currentTabStopId:f,defaultCurrentTabStopId:g,onCurrentTabStopIdChange:b,onEntryFocus:_,preventScrollOnEntryFocus:S=!1,...R}=t,C=React__namespace.useRef(null),E=useComposedRefs(e,C),A=useDirection(d),[M,I]=useControllableState({prop:f,defaultProp:g??null,onChange:b,caller:GROUP_NAME$3}),[j,q]=React__namespace.useState(!1),z=useCallbackRef$1(_),Q=useCollection$3(n),F=React__namespace.useRef(!1),[V,te]=React__namespace.useState(0);return React__namespace.useEffect(()=>{const ne=C.current;if(ne)return ne.addEventListener(ENTRY_FOCUS,z),()=>ne.removeEventListener(ENTRY_FOCUS,z)},[z]),jsxRuntime.jsx(RovingFocusProvider,{scope:n,orientation:o,dir:A,loop:l,currentTabStopId:M,onItemFocus:React__namespace.useCallback(ne=>I(ne),[I]),onItemShiftTab:React__namespace.useCallback(()=>q(!0),[]),onFocusableItemAdd:React__namespace.useCallback(()=>te(ne=>ne+1),[]),onFocusableItemRemove:React__namespace.useCallback(()=>te(ne=>ne-1),[]),children:jsxRuntime.jsx(Primitive.div,{tabIndex:j||V===0?-1:0,"data-orientation":o,...R,ref:E,style:{outline:"none",...t.style},onMouseDown:composeEventHandlers(t.onMouseDown,()=>{F.current=!0}),onFocus:composeEventHandlers(t.onFocus,ne=>{const se=!F.current;if(ne.target===ne.currentTarget&&se&&!j){const ge=new CustomEvent(ENTRY_FOCUS,EVENT_OPTIONS$1);if(ne.currentTarget.dispatchEvent(ge),!ge.defaultPrevented){const oe=Q().filter(Fe=>Fe.focusable),Ae=oe.find(Fe=>Fe.active),je=oe.find(Fe=>Fe.id===M),Oe=[Ae,je,...oe].filter(Boolean).map(Fe=>Fe.ref.current);focusFirst$3(Oe,S)}}F.current=!1}),onBlur:composeEventHandlers(t.onBlur,()=>q(!1))})})}),ITEM_NAME$4="RovingFocusGroupItem",RovingFocusGroupItem=React__namespace.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:l=!1,tabStopId:d,children:f,...g}=t,b=useId(),_=d||b,S=useRovingFocusContext(ITEM_NAME$4,n),R=S.currentTabStopId===_,C=useCollection$3(n),{onFocusableItemAdd:E,onFocusableItemRemove:A,currentTabStopId:M}=S;return React__namespace.useEffect(()=>{if(o)return E(),()=>A()},[o,E,A]),jsxRuntime.jsx(Collection$3.ItemSlot,{scope:n,id:_,focusable:o,active:l,children:jsxRuntime.jsx(Primitive.span,{tabIndex:R?0:-1,"data-orientation":S.orientation,...g,ref:e,onMouseDown:composeEventHandlers(t.onMouseDown,I=>{o?S.onItemFocus(_):I.preventDefault()}),onFocus:composeEventHandlers(t.onFocus,()=>S.onItemFocus(_)),onKeyDown:composeEventHandlers(t.onKeyDown,I=>{if(I.key==="Tab"&&I.shiftKey){S.onItemShiftTab();return}if(I.target!==I.currentTarget)return;const j=getFocusIntent(I,S.orientation,S.dir);if(j!==void 0){if(I.metaKey||I.ctrlKey||I.altKey||I.shiftKey)return;I.preventDefault();let z=C().filter(Q=>Q.focusable).map(Q=>Q.ref.current);if(j==="last")z.reverse();else if(j==="prev"||j==="next"){j==="prev"&&z.reverse();const Q=z.indexOf(I.currentTarget);z=S.loop?wrapArray$2(z,Q+1):z.slice(Q+1)}setTimeout(()=>focusFirst$3(z))}}),children:typeof f=="function"?f({isCurrentTabStop:R,hasTabStop:M!=null}):f})})});RovingFocusGroupItem.displayName=ITEM_NAME$4;var MAP_KEY_TO_FOCUS_INTENT={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function getDirectionAwareKey(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function getFocusIntent(t,e,n){const o=getDirectionAwareKey(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return MAP_KEY_TO_FOCUS_INTENT[o]}function focusFirst$3(t,e=!1){const n=document.activeElement;for(const o of t)if(o===n||(o.focus({preventScroll:e}),document.activeElement!==n))return}function wrapArray$2(t,e){return t.map((n,o)=>t[(e+o)%t.length])}var Root$a=RovingFocusGroup,Item$2=RovingFocusGroupItem;function useSize(t){const[e,n]=React__namespace.useState(void 0);return useLayoutEffect2(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const o=new ResizeObserver(l=>{if(!Array.isArray(l)||!l.length)return;const d=l[0];let f,g;if("borderBoxSize"in d){const b=d.borderBoxSize,_=Array.isArray(b)?b[0]:b;f=_.inlineSize,g=_.blockSize}else f=t.offsetWidth,g=t.offsetHeight;n({width:f,height:g})});return o.observe(t,{box:"border-box"}),()=>o.unobserve(t)}else n(void 0)},[t]),e}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])}function useStateMachine$1(t,e){return React__namespace.useReducer((n,o)=>e[n][o]??n,t)}var Presence=t=>{const{present:e,children:n}=t,o=usePresence(e),l=typeof n=="function"?n({present:o.isPresent}):React__namespace.Children.only(n),d=useComposedRefs(o.ref,getElementRef(l));return typeof n=="function"||o.isPresent?React__namespace.cloneElement(l,{ref:d}):null};Presence.displayName="Presence";function usePresence(t){const[e,n]=React__namespace.useState(),o=React__namespace.useRef(null),l=React__namespace.useRef(t),d=React__namespace.useRef("none"),f=t?"mounted":"unmounted",[g,b]=useStateMachine$1(f,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return React__namespace.useEffect(()=>{const _=getAnimationName(o.current);d.current=g==="mounted"?_:"none"},[g]),useLayoutEffect2(()=>{const _=o.current,S=l.current;if(S!==t){const C=d.current,E=getAnimationName(_);t?b("MOUNT"):E==="none"||(_==null?void 0:_.display)==="none"?b("UNMOUNT"):b(S&&C!==E?"ANIMATION_OUT":"UNMOUNT"),l.current=t}},[t,b]),useLayoutEffect2(()=>{if(e){let _;const S=e.ownerDocument.defaultView??window,R=E=>{const M=getAnimationName(o.current).includes(E.animationName);if(E.target===e&&M&&(b("ANIMATION_END"),!l.current)){const I=e.style.animationFillMode;e.style.animationFillMode="forwards",_=S.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=I)})}},C=E=>{E.target===e&&(d.current=getAnimationName(o.current))};return e.addEventListener("animationstart",C),e.addEventListener("animationcancel",R),e.addEventListener("animationend",R),()=>{S.clearTimeout(_),e.removeEventListener("animationstart",C),e.removeEventListener("animationcancel",R),e.removeEventListener("animationend",R)}}else b("ANIMATION_END")},[e,b]),{isPresent:["mounted","unmountSuspended"].includes(g),ref:React__namespace.useCallback(_=>{o.current=_?getComputedStyle(_):null,n(_)},[])}}function getAnimationName(t){return(t==null?void 0:t.animationName)||"none"}function getElementRef(t){var o,l;let e=(o=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(l=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:l.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var RADIO_NAME="Radio",[createRadioContext,createRadioScope]=createContextScope(RADIO_NAME),[RadioProvider,useRadioContext]=createRadioContext(RADIO_NAME),Radio=React__namespace.forwardRef((t,e)=>{const{__scopeRadio:n,name:o,checked:l=!1,required:d,disabled:f,value:g="on",onCheck:b,form:_,...S}=t,[R,C]=React__namespace.useState(null),E=useComposedRefs(e,I=>C(I)),A=React__namespace.useRef(!1),M=R?_||!!R.closest("form"):!0;return jsxRuntime.jsxs(RadioProvider,{scope:n,checked:l,disabled:f,children:[jsxRuntime.jsx(Primitive.button,{type:"button",role:"radio","aria-checked":l,"data-state":getState$4(l),"data-disabled":f?"":void 0,disabled:f,value:g,...S,ref:E,onClick:composeEventHandlers(t.onClick,I=>{l||b==null||b(),M&&(A.current=I.isPropagationStopped(),A.current||I.stopPropagation())})}),M&&jsxRuntime.jsx(RadioBubbleInput,{control:R,bubbles:!A.current,name:o,value:g,checked:l,required:d,disabled:f,form:_,style:{transform:"translateX(-100%)"}})]})});Radio.displayName=RADIO_NAME;var INDICATOR_NAME$3="RadioIndicator",RadioIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeRadio:n,forceMount:o,...l}=t,d=useRadioContext(INDICATOR_NAME$3,n);return jsxRuntime.jsx(Presence,{present:o||d.checked,children:jsxRuntime.jsx(Primitive.span,{"data-state":getState$4(d.checked),"data-disabled":d.disabled?"":void 0,...l,ref:e})})});RadioIndicator.displayName=INDICATOR_NAME$3;var BUBBLE_INPUT_NAME$3="RadioBubbleInput",RadioBubbleInput=React__namespace.forwardRef(({__scopeRadio:t,control:e,checked:n,bubbles:o=!0,...l},d)=>{const f=React__namespace.useRef(null),g=useComposedRefs(f,d),b=usePrevious(n),_=useSize(e);return React__namespace.useEffect(()=>{const S=f.current;if(!S)return;const R=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(R,"checked").set;if(b!==n&&E){const A=new Event("click",{bubbles:o});E.call(S,n),S.dispatchEvent(A)}},[b,n,o]),jsxRuntime.jsx(Primitive.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...l,tabIndex:-1,ref:g,style:{...l.style,..._,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});RadioBubbleInput.displayName=BUBBLE_INPUT_NAME$3;function getState$4(t){return t?"checked":"unchecked"}var ARROW_KEYS=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],RADIO_GROUP_NAME$2="RadioGroup",[createRadioGroupContext,createRadioGroupScope]=createContextScope(RADIO_GROUP_NAME$2,[createRovingFocusGroupScope,createRadioScope]),useRovingFocusGroupScope$2=createRovingFocusGroupScope(),useRadioScope=createRadioScope(),[RadioGroupProvider$1,useRadioGroupContext$1]=createRadioGroupContext(RADIO_GROUP_NAME$2),RadioGroup$2=React__namespace.forwardRef((t,e)=>{const{__scopeRadioGroup:n,name:o,defaultValue:l,value:d,required:f=!1,disabled:g=!1,orientation:b,dir:_,loop:S=!0,onValueChange:R,...C}=t,E=useRovingFocusGroupScope$2(n),A=useDirection(_),[M,I]=useControllableState({prop:d,defaultProp:l??null,onChange:R,caller:RADIO_GROUP_NAME$2});return jsxRuntime.jsx(RadioGroupProvider$1,{scope:n,name:o,required:f,disabled:g,value:M,onValueChange:I,children:jsxRuntime.jsx(Root$a,{asChild:!0,...E,orientation:b,dir:A,loop:S,children:jsxRuntime.jsx(Primitive.div,{role:"radiogroup","aria-required":f,"aria-orientation":b,"data-disabled":g?"":void 0,dir:A,...C,ref:e})})})});RadioGroup$2.displayName=RADIO_GROUP_NAME$2;var ITEM_NAME$3="RadioGroupItem",RadioGroupItem$1=React__namespace.forwardRef((t,e)=>{const{__scopeRadioGroup:n,disabled:o,...l}=t,d=useRadioGroupContext$1(ITEM_NAME$3,n),f=d.disabled||o,g=useRovingFocusGroupScope$2(n),b=useRadioScope(n),_=React__namespace.useRef(null),S=useComposedRefs(e,_),R=d.value===l.value,C=React__namespace.useRef(!1);return React__namespace.useEffect(()=>{const E=M=>{ARROW_KEYS.includes(M.key)&&(C.current=!0)},A=()=>C.current=!1;return document.addEventListener("keydown",E),document.addEventListener("keyup",A),()=>{document.removeEventListener("keydown",E),document.removeEventListener("keyup",A)}},[]),jsxRuntime.jsx(Item$2,{asChild:!0,...g,focusable:!f,active:R,children:jsxRuntime.jsx(Radio,{disabled:f,required:d.required,checked:R,...b,...l,name:d.name,ref:S,onCheck:()=>d.onValueChange(l.value),onKeyDown:composeEventHandlers(E=>{E.key==="Enter"&&E.preventDefault()}),onFocus:composeEventHandlers(l.onFocus,()=>{var E;C.current&&((E=_.current)==null||E.click())})})})});RadioGroupItem$1.displayName=ITEM_NAME$3;var INDICATOR_NAME2="RadioGroupIndicator",RadioGroupIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeRadioGroup:n,...o}=t,l=useRadioScope(n);return jsxRuntime.jsx(RadioIndicator,{...l,...o,ref:e})});RadioGroupIndicator.displayName=INDICATOR_NAME2;var Root2$7=RadioGroup$2,Item2$2=RadioGroupItem$1,Indicator$1=RadioGroupIndicator;const RadioGroup$1=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Root2$7,{className:cn("grid gap-2",t),...e,ref:n}));RadioGroup$1.displayName=Root2$7.displayName;const RadioGroupItem=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Item2$2,{ref:n,className:cn("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow-sm focus:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:jsxRuntime.jsx(Indicator$1,{className:"flex items-center justify-center",children:jsxRuntime.jsx(Circle,{className:"h-3.5 w-3.5 fill-primary"})})}));RadioGroupItem.displayName=Item2$2.displayName;function useEscapeKeydown(t,e=globalThis==null?void 0:globalThis.document){const n=useCallbackRef$1(t);React__namespace.useEffect(()=>{const o=l=>{l.key==="Escape"&&n(l)};return e.addEventListener("keydown",o,{capture:!0}),()=>e.removeEventListener("keydown",o,{capture:!0})},[n,e])}var DISMISSABLE_LAYER_NAME="DismissableLayer",CONTEXT_UPDATE="dismissableLayer.update",POINTER_DOWN_OUTSIDE="dismissableLayer.pointerDownOutside",FOCUS_OUTSIDE="dismissableLayer.focusOutside",originalBodyPointerEvents,DismissableLayerContext=React__namespace.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),DismissableLayer=React__namespace.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:f,onDismiss:g,...b}=t,_=React__namespace.useContext(DismissableLayerContext),[S,R]=React__namespace.useState(null),C=(S==null?void 0:S.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,E]=React__namespace.useState({}),A=useComposedRefs(e,te=>R(te)),M=Array.from(_.layers),[I]=[..._.layersWithOutsidePointerEventsDisabled].slice(-1),j=M.indexOf(I),q=S?M.indexOf(S):-1,z=_.layersWithOutsidePointerEventsDisabled.size>0,Q=q>=j,F=usePointerDownOutside(te=>{const ne=te.target,se=[..._.branches].some(ge=>ge.contains(ne));!Q||se||(l==null||l(te),f==null||f(te),te.defaultPrevented||g==null||g())},C),V=useFocusOutside(te=>{const ne=te.target;[..._.branches].some(ge=>ge.contains(ne))||(d==null||d(te),f==null||f(te),te.defaultPrevented||g==null||g())},C);return useEscapeKeydown(te=>{q===_.layers.size-1&&(o==null||o(te),!te.defaultPrevented&&g&&(te.preventDefault(),g()))},C),React__namespace.useEffect(()=>{if(S)return n&&(_.layersWithOutsidePointerEventsDisabled.size===0&&(originalBodyPointerEvents=C.body.style.pointerEvents,C.body.style.pointerEvents="none"),_.layersWithOutsidePointerEventsDisabled.add(S)),_.layers.add(S),dispatchUpdate(),()=>{n&&_.layersWithOutsidePointerEventsDisabled.size===1&&(C.body.style.pointerEvents=originalBodyPointerEvents)}},[S,C,n,_]),React__namespace.useEffect(()=>()=>{S&&(_.layers.delete(S),_.layersWithOutsidePointerEventsDisabled.delete(S),dispatchUpdate())},[S,_]),React__namespace.useEffect(()=>{const te=()=>E({});return document.addEventListener(CONTEXT_UPDATE,te),()=>document.removeEventListener(CONTEXT_UPDATE,te)},[]),jsxRuntime.jsx(Primitive.div,{...b,ref:A,style:{pointerEvents:z?Q?"auto":"none":void 0,...t.style},onFocusCapture:composeEventHandlers(t.onFocusCapture,V.onFocusCapture),onBlurCapture:composeEventHandlers(t.onBlurCapture,V.onBlurCapture),onPointerDownCapture:composeEventHandlers(t.onPointerDownCapture,F.onPointerDownCapture)})});DismissableLayer.displayName=DISMISSABLE_LAYER_NAME;var BRANCH_NAME="DismissableLayerBranch",DismissableLayerBranch=React__namespace.forwardRef((t,e)=>{const n=React__namespace.useContext(DismissableLayerContext),o=React__namespace.useRef(null),l=useComposedRefs(e,o);return React__namespace.useEffect(()=>{const d=o.current;if(d)return n.branches.add(d),()=>{n.branches.delete(d)}},[n.branches]),jsxRuntime.jsx(Primitive.div,{...t,ref:l})});DismissableLayerBranch.displayName=BRANCH_NAME;function usePointerDownOutside(t,e=globalThis==null?void 0:globalThis.document){const n=useCallbackRef$1(t),o=React__namespace.useRef(!1),l=React__namespace.useRef(()=>{});return React__namespace.useEffect(()=>{const d=g=>{if(g.target&&!o.current){let b=function(){handleAndDispatchCustomEvent$1(POINTER_DOWN_OUTSIDE,n,_,{discrete:!0})};const _={originalEvent:g};g.pointerType==="touch"?(e.removeEventListener("click",l.current),l.current=b,e.addEventListener("click",l.current,{once:!0})):b()}else e.removeEventListener("click",l.current);o.current=!1},f=window.setTimeout(()=>{e.addEventListener("pointerdown",d)},0);return()=>{window.clearTimeout(f),e.removeEventListener("pointerdown",d),e.removeEventListener("click",l.current)}},[e,n]),{onPointerDownCapture:()=>o.current=!0}}function useFocusOutside(t,e=globalThis==null?void 0:globalThis.document){const n=useCallbackRef$1(t),o=React__namespace.useRef(!1);return React__namespace.useEffect(()=>{const l=d=>{d.target&&!o.current&&handleAndDispatchCustomEvent$1(FOCUS_OUTSIDE,n,{originalEvent:d},{discrete:!1})};return e.addEventListener("focusin",l),()=>e.removeEventListener("focusin",l)},[e,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function dispatchUpdate(){const t=new CustomEvent(CONTEXT_UPDATE);document.dispatchEvent(t)}function handleAndDispatchCustomEvent$1(t,e,n,{discrete:o}){const l=n.originalEvent.target,d=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&l.addEventListener(t,e,{once:!0}),o?dispatchDiscreteCustomEvent(l,d):l.dispatchEvent(d)}var Root$9=DismissableLayer,Branch$1=DismissableLayerBranch,AUTOFOCUS_ON_MOUNT="focusScope.autoFocusOnMount",AUTOFOCUS_ON_UNMOUNT="focusScope.autoFocusOnUnmount",EVENT_OPTIONS={bubbles:!1,cancelable:!0},FOCUS_SCOPE_NAME="FocusScope",FocusScope=React__namespace.forwardRef((t,e)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:l,onUnmountAutoFocus:d,...f}=t,[g,b]=React__namespace.useState(null),_=useCallbackRef$1(l),S=useCallbackRef$1(d),R=React__namespace.useRef(null),C=useComposedRefs(e,M=>b(M)),E=React__namespace.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;React__namespace.useEffect(()=>{if(o){let M=function(z){if(E.paused||!g)return;const Q=z.target;g.contains(Q)?R.current=Q:focus$1(R.current,{select:!0})},I=function(z){if(E.paused||!g)return;const Q=z.relatedTarget;Q!==null&&(g.contains(Q)||focus$1(R.current,{select:!0}))},j=function(z){if(document.activeElement===document.body)for(const F of z)F.removedNodes.length>0&&focus$1(g)};document.addEventListener("focusin",M),document.addEventListener("focusout",I);const q=new MutationObserver(j);return g&&q.observe(g,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",M),document.removeEventListener("focusout",I),q.disconnect()}}},[o,g,E.paused]),React__namespace.useEffect(()=>{if(g){focusScopesStack.add(E);const M=document.activeElement;if(!g.contains(M)){const j=new CustomEvent(AUTOFOCUS_ON_MOUNT,EVENT_OPTIONS);g.addEventListener(AUTOFOCUS_ON_MOUNT,_),g.dispatchEvent(j),j.defaultPrevented||(focusFirst$2(removeLinks(getTabbableCandidates$1(g)),{select:!0}),document.activeElement===M&&focus$1(g))}return()=>{g.removeEventListener(AUTOFOCUS_ON_MOUNT,_),setTimeout(()=>{const j=new CustomEvent(AUTOFOCUS_ON_UNMOUNT,EVENT_OPTIONS);g.addEventListener(AUTOFOCUS_ON_UNMOUNT,S),g.dispatchEvent(j),j.defaultPrevented||focus$1(M??document.body,{select:!0}),g.removeEventListener(AUTOFOCUS_ON_UNMOUNT,S),focusScopesStack.remove(E)},0)}}},[g,_,S,E]);const A=React__namespace.useCallback(M=>{if(!n&&!o||E.paused)return;const I=M.key==="Tab"&&!M.altKey&&!M.ctrlKey&&!M.metaKey,j=document.activeElement;if(I&&j){const q=M.currentTarget,[z,Q]=getTabbableEdges(q);z&&Q?!M.shiftKey&&j===Q?(M.preventDefault(),n&&focus$1(z,{select:!0})):M.shiftKey&&j===z&&(M.preventDefault(),n&&focus$1(Q,{select:!0})):j===q&&M.preventDefault()}},[n,o,E.paused]);return jsxRuntime.jsx(Primitive.div,{tabIndex:-1,...f,ref:C,onKeyDown:A})});FocusScope.displayName=FOCUS_SCOPE_NAME;function focusFirst$2(t,{select:e=!1}={}){const n=document.activeElement;for(const o of t)if(focus$1(o,{select:e}),document.activeElement!==n)return}function getTabbableEdges(t){const e=getTabbableCandidates$1(t),n=findVisible(e,t),o=findVisible(e.reverse(),t);return[n,o]}function getTabbableCandidates$1(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const l=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||l?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function findVisible(t,e){for(const n of t)if(!isHidden(n,{upTo:e}))return n}function isHidden(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function isSelectableInput(t){return t instanceof HTMLInputElement&&"select"in t}function focus$1(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&isSelectableInput(t)&&e&&t.select()}}var focusScopesStack=createFocusScopesStack();function createFocusScopesStack(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=arrayRemove(t,e),t.unshift(e)},remove(e){var n;t=arrayRemove(t,e),(n=t[0])==null||n.resume()}}}function arrayRemove(t,e){const n=[...t],o=n.indexOf(e);return o!==-1&&n.splice(o,1),n}function removeLinks(t){return t.filter(e=>e.tagName!=="A")}var PORTAL_NAME$7="Portal",Portal$5=React__namespace.forwardRef((t,e)=>{var g;const{container:n,...o}=t,[l,d]=React__namespace.useState(!1);useLayoutEffect2(()=>d(!0),[]);const f=n||l&&((g=globalThis==null?void 0:globalThis.document)==null?void 0:g.body);return f?ReactDOM.createPortal(jsxRuntime.jsx(Primitive.div,{...o,ref:e}),f):null});Portal$5.displayName=PORTAL_NAME$7;var count$2=0;function useFocusGuards(){React__namespace.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??createFocusGuard()),document.body.insertAdjacentElement("beforeend",t[1]??createFocusGuard()),count$2++,()=>{count$2===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),count$2--}},[])}function createFocusGuard(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var __assign$1=function(){return __assign$1=Object.assign||function(e){for(var n,o=1,l=arguments.length;o<l;o++){n=arguments[o];for(var d in n)Object.prototype.hasOwnProperty.call(n,d)&&(e[d]=n[d])}return e},__assign$1.apply(this,arguments)};function __rest(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,o=Object.getOwnPropertySymbols(t);l<o.length;l++)e.indexOf(o[l])<0&&Object.prototype.propertyIsEnumerable.call(t,o[l])&&(n[o[l]]=t[o[l]]);return n}function __spreadArray(t,e,n){if(n||arguments.length===2)for(var o=0,l=e.length,d;o<l;o++)(d||!(o in e))&&(d||(d=Array.prototype.slice.call(e,0,o)),d[o]=e[o]);return t.concat(d||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;var zeroRightClassName="right-scroll-bar-position",fullWidthClassName="width-before-scroll-bar",noScrollbarsClassName="with-scroll-bars-hidden",removedBarSizeVariable="--removed-body-scroll-bar-size";function assignRef(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function useCallbackRef(t,e){var n=React.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(o){var l=n.value;l!==o&&(n.value=o,n.callback(o,l))}}}})[0];return n.callback=e,n.facade}var useIsomorphicLayoutEffect$3=typeof window<"u"?React__namespace.useLayoutEffect:React__namespace.useEffect,currentValues=new WeakMap;function useMergeRefs(t,e){var n=useCallbackRef(null,function(o){return t.forEach(function(l){return assignRef(l,o)})});return useIsomorphicLayoutEffect$3(function(){var o=currentValues.get(n);if(o){var l=new Set(o),d=new Set(t),f=n.current;l.forEach(function(g){d.has(g)||assignRef(g,null)}),d.forEach(function(g){l.has(g)||assignRef(g,f)})}currentValues.set(n,t)},[t]),n}function ItoI(t){return t}function innerCreateMedium(t,e){e===void 0&&(e=ItoI);var n=[],o=!1,l={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(d){var f=e(d,o);return n.push(f),function(){n=n.filter(function(g){return g!==f})}},assignSyncMedium:function(d){for(o=!0;n.length;){var f=n;n=[],f.forEach(d)}n={push:function(g){return d(g)},filter:function(){return n}}},assignMedium:function(d){o=!0;var f=[];if(n.length){var g=n;n=[],g.forEach(d),f=n}var b=function(){var S=f;f=[],S.forEach(d)},_=function(){return Promise.resolve().then(b)};_(),n={push:function(S){f.push(S),_()},filter:function(S){return f=f.filter(S),n}}}};return l}function createSidecarMedium(t){t===void 0&&(t={});var e=innerCreateMedium(null);return e.options=__assign$1({async:!0,ssr:!1},t),e}var SideCar$1=function(t){var e=t.sideCar,n=__rest(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=e.read();if(!o)throw new Error("Sidecar medium not found");return React__namespace.createElement(o,__assign$1({},n))};SideCar$1.isSideCarExport=!0;function exportSidecar(t,e){return t.useMedium(e),SideCar$1}var effectCar=createSidecarMedium(),nothing=function(){},RemoveScroll=React__namespace.forwardRef(function(t,e){var n=React__namespace.useRef(null),o=React__namespace.useState({onScrollCapture:nothing,onWheelCapture:nothing,onTouchMoveCapture:nothing}),l=o[0],d=o[1],f=t.forwardProps,g=t.children,b=t.className,_=t.removeScrollBar,S=t.enabled,R=t.shards,C=t.sideCar,E=t.noRelative,A=t.noIsolation,M=t.inert,I=t.allowPinchZoom,j=t.as,q=j===void 0?"div":j,z=t.gapMode,Q=__rest(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=C,V=useMergeRefs([n,e]),te=__assign$1(__assign$1({},Q),l);return React__namespace.createElement(React__namespace.Fragment,null,S&&React__namespace.createElement(F,{sideCar:effectCar,removeScrollBar:_,shards:R,noRelative:E,noIsolation:A,inert:M,setCallbacks:d,allowPinchZoom:!!I,lockRef:n,gapMode:z}),f?React__namespace.cloneElement(React__namespace.Children.only(g),__assign$1(__assign$1({},te),{ref:V})):React__namespace.createElement(q,__assign$1({},te,{className:b,ref:V}),g))});RemoveScroll.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},RemoveScroll.classNames={fullWidth:fullWidthClassName,zeroRight:zeroRightClassName};var getNonce=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function makeStyleTag(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=getNonce();return e&&t.setAttribute("nonce",e),t}function injectStyles(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function insertStyleTag(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var stylesheetSingleton=function(){var t=0,e=null;return{add:function(n){t==0&&(e=makeStyleTag())&&(injectStyles(e,n),insertStyleTag(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},styleHookSingleton=function(){var t=stylesheetSingleton();return function(e,n){React__namespace.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},styleSingleton=function(){var t=styleHookSingleton(),e=function(n){var o=n.styles,l=n.dynamic;return t(o,l),null};return e},zeroGap={left:0,top:0,right:0,gap:0},parse=function(t){return parseInt(t||"",10)||0},getOffset$1=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],o=e[t==="padding"?"paddingTop":"marginTop"],l=e[t==="padding"?"paddingRight":"marginRight"];return[parse(n),parse(o),parse(l)]},getGapWidth=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return zeroGap;var e=getOffset$1(t),n=document.documentElement.clientWidth,o=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,o-n+e[2]-e[0])}},Style=styleSingleton(),lockAttribute="data-scroll-locked",getStyles=function(t,e,n,o){var l=t.left,d=t.top,f=t.right,g=t.gap;return n===void 0&&(n="margin"),`
426
426
  .`.concat(noScrollbarsClassName,` {
427
427
  overflow: hidden `).concat(o,`;
428
428
  padding-right: `).concat(g,"px ").concat(o,`;
@@ -593,7 +593,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
593
593
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray$2(t,e){if(t){if(typeof t=="string")return _arrayLikeToArray$2(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray$2(t,e)}}function _arrayLikeToArray$2(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function _iterableToArrayLimit$1(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var o,l,d,f,g=[],b=!0,_=!1;try{if(d=(n=n.call(t)).next,e!==0)for(;!(b=(o=d.call(n)).done)&&(g.push(o.value),g.length!==e);b=!0);}catch(S){_=!0,l=S}finally{try{if(!b&&n.return!=null&&(f=n.return(),Object(f)!==f))return}finally{if(_)throw l}}return g}}function _arrayWithHoles$1(t){if(Array.isArray(t))return t}function _extends$8(){return _extends$8=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},_extends$8.apply(this,arguments)}var renderLine=function(e,n){var o;return React.isValidElement(e)?o=React.cloneElement(e,n):isFunction$4(e)?o=e(n):o=React.createElement("line",_extends$8({},n,{className:"recharts-reference-line-line"})),o},getEndPoints=function(e,n,o,l,d,f,g,b,_){var S=d.x,R=d.y,C=d.width,E=d.height;if(o){var A=_.y,M=e.y.apply(A,{position:f});if(ifOverflowMatches(_,"discard")&&!e.y.isInRange(M))return null;var I=[{x:S+C,y:M},{x:S,y:M}];return b==="left"?I.reverse():I}if(n){var j=_.x,q=e.x.apply(j,{position:f});if(ifOverflowMatches(_,"discard")&&!e.x.isInRange(q))return null;var z=[{x:q,y:R+E},{x:q,y:R}];return g==="top"?z.reverse():z}if(l){var Q=_.segment,F=Q.map(function(V){return e.apply(V,{position:f})});return ifOverflowMatches(_,"discard")&&some(F,function(V){return!e.isInRange(V)})?null:F}return null};function ReferenceLineImpl(t){var e=t.x,n=t.y,o=t.segment,l=t.xAxisId,d=t.yAxisId,f=t.shape,g=t.className,b=t.alwaysShow,_=useClipPathId(),S=useXAxisOrThrow(l),R=useYAxisOrThrow(d),C=useViewBox();if(!_||!C)return null;warn$1(b===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var E=createLabeledScales({x:S.scale,y:R.scale}),A=isNumOrStr(e),M=isNumOrStr(n),I=o&&o.length===2,j=getEndPoints(E,A,M,I,C,t.position,S.orientation,R.orientation,t);if(!j)return null;var q=_slicedToArray$1(j,2),z=q[0],Q=z.x,F=z.y,V=q[1],te=V.x,ne=V.y,se=ifOverflowMatches(t,"hidden")?"url(#".concat(_,")"):void 0,ge=_objectSpread$8(_objectSpread$8({clipPath:se},filterProps(t,!0)),{},{x1:Q,y1:F,x2:te,y2:ne});return React.createElement(Layer,{className:clsx("recharts-reference-line",g)},renderLine(f,ge),Label$1.renderCallByParent(t,rectWithCoords({x1:Q,y1:F,x2:te,y2:ne})))}var ReferenceLine=function(t){function e(){return _classCallCheck$8(this,e),_callSuper$7(this,e,arguments)}return _inherits$7(e,t),_createClass$8(e,[{key:"render",value:function(){return React.createElement(ReferenceLineImpl,this.props)}}])}(React.Component);_defineProperty$b(ReferenceLine,"displayName","ReferenceLine"),_defineProperty$b(ReferenceLine,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function _extends$7(){return _extends$7=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},_extends$7.apply(this,arguments)}function _typeof$a(t){"@babel/helpers - typeof";return _typeof$a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$a(t)}function ownKeys$7(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(l){return Object.getOwnPropertyDescriptor(t,l).enumerable})),n.push.apply(n,o)}return n}function _objectSpread$7(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ownKeys$7(Object(n),!0).forEach(function(o){_defineProperty$a(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys$7(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function _classCallCheck$7(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties$7(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,_toPropertyKey$a(o.key),o)}}function _createClass$7(t,e,n){return e&&_defineProperties$7(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function _callSuper$6(t,e,n){return e=_getPrototypeOf$6(e),_possibleConstructorReturn$6(t,_isNativeReflectConstruct$6()?Reflect.construct(e,n||[],_getPrototypeOf$6(t).constructor):e.apply(t,n))}function _possibleConstructorReturn$6(t,e){if(e&&(_typeof$a(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$6(t)}function _assertThisInitialized$6(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _isNativeReflectConstruct$6(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_isNativeReflectConstruct$6=function(){return!!t})()}function _getPrototypeOf$6(t){return _getPrototypeOf$6=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},_getPrototypeOf$6(t)}function _inherits$6(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf$6(t,e)}function _setPrototypeOf$6(t,e){return _setPrototypeOf$6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,l){return o.__proto__=l,o},_setPrototypeOf$6(t,e)}function _defineProperty$a(t,e,n){return e=_toPropertyKey$a(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _toPropertyKey$a(t){var e=_toPrimitive$a(t,"string");return _typeof$a(e)=="symbol"?e:e+""}function _toPrimitive$a(t,e){if(_typeof$a(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(_typeof$a(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var getCoordinate=function(e){var n=e.x,o=e.y,l=e.xAxis,d=e.yAxis,f=createLabeledScales({x:l.scale,y:d.scale}),g=f.apply({x:n,y:o},{bandAware:!0});return ifOverflowMatches(e,"discard")&&!f.isInRange(g)?null:g},ReferenceDot=function(t){function e(){return _classCallCheck$7(this,e),_callSuper$6(this,e,arguments)}return _inherits$6(e,t),_createClass$7(e,[{key:"render",value:function(){var o=this.props,l=o.x,d=o.y,f=o.r,g=o.alwaysShow,b=o.clipPathId,_=isNumOrStr(l),S=isNumOrStr(d);if(warn$1(g===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!_||!S)return null;var R=getCoordinate(this.props);if(!R)return null;var C=R.x,E=R.y,A=this.props,M=A.shape,I=A.className,j=ifOverflowMatches(this.props,"hidden")?"url(#".concat(b,")"):void 0,q=_objectSpread$7(_objectSpread$7({clipPath:j},filterProps(this.props,!0)),{},{cx:C,cy:E});return React.createElement(Layer,{className:clsx("recharts-reference-dot",I)},e.renderDot(M,q),Label$1.renderCallByParent(this.props,{x:C-f,y:E-f,width:2*f,height:2*f}))}}])}(React.Component);_defineProperty$a(ReferenceDot,"displayName","ReferenceDot"),_defineProperty$a(ReferenceDot,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1}),_defineProperty$a(ReferenceDot,"renderDot",function(t,e){var n;return React.isValidElement(t)?n=React.cloneElement(t,e):isFunction$4(t)?n=t(e):n=React.createElement(Dot,_extends$7({},e,{cx:e.cx,cy:e.cy,className:"recharts-reference-dot-dot"})),n});function _extends$6(){return _extends$6=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},_extends$6.apply(this,arguments)}function _typeof$9(t){"@babel/helpers - typeof";return _typeof$9=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$9(t)}function ownKeys$6(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(l){return Object.getOwnPropertyDescriptor(t,l).enumerable})),n.push.apply(n,o)}return n}function _objectSpread$6(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ownKeys$6(Object(n),!0).forEach(function(o){_defineProperty$9(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys$6(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function _classCallCheck$6(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties$6(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,_toPropertyKey$9(o.key),o)}}function _createClass$6(t,e,n){return e&&_defineProperties$6(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function _callSuper$5(t,e,n){return e=_getPrototypeOf$5(e),_possibleConstructorReturn$5(t,_isNativeReflectConstruct$5()?Reflect.construct(e,n||[],_getPrototypeOf$5(t).constructor):e.apply(t,n))}function _possibleConstructorReturn$5(t,e){if(e&&(_typeof$9(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$5(t)}function _assertThisInitialized$5(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _isNativeReflectConstruct$5(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_isNativeReflectConstruct$5=function(){return!!t})()}function _getPrototypeOf$5(t){return _getPrototypeOf$5=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},_getPrototypeOf$5(t)}function _inherits$5(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf$5(t,e)}function _setPrototypeOf$5(t,e){return _setPrototypeOf$5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,l){return o.__proto__=l,o},_setPrototypeOf$5(t,e)}function _defineProperty$9(t,e,n){return e=_toPropertyKey$9(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _toPropertyKey$9(t){var e=_toPrimitive$9(t,"string");return _typeof$9(e)=="symbol"?e:e+""}function _toPrimitive$9(t,e){if(_typeof$9(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(_typeof$9(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var getRect=function(e,n,o,l,d){var f=d.x1,g=d.x2,b=d.y1,_=d.y2,S=d.xAxis,R=d.yAxis;if(!S||!R)return null;var C=createLabeledScales({x:S.scale,y:R.scale}),E={x:e?C.x.apply(f,{position:"start"}):C.x.rangeMin,y:o?C.y.apply(b,{position:"start"}):C.y.rangeMin},A={x:n?C.x.apply(g,{position:"end"}):C.x.rangeMax,y:l?C.y.apply(_,{position:"end"}):C.y.rangeMax};return ifOverflowMatches(d,"discard")&&(!C.isInRange(E)||!C.isInRange(A))?null:rectWithPoints(E,A)},ReferenceArea=function(t){function e(){return _classCallCheck$6(this,e),_callSuper$5(this,e,arguments)}return _inherits$5(e,t),_createClass$6(e,[{key:"render",value:function(){var o=this.props,l=o.x1,d=o.x2,f=o.y1,g=o.y2,b=o.className,_=o.alwaysShow,S=o.clipPathId;warn$1(_===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var R=isNumOrStr(l),C=isNumOrStr(d),E=isNumOrStr(f),A=isNumOrStr(g),M=this.props.shape;if(!R&&!C&&!E&&!A&&!M)return null;var I=getRect(R,C,E,A,this.props);if(!I&&!M)return null;var j=ifOverflowMatches(this.props,"hidden")?"url(#".concat(S,")"):void 0;return React.createElement(Layer,{className:clsx("recharts-reference-area",b)},e.renderRect(M,_objectSpread$6(_objectSpread$6({clipPath:j},filterProps(this.props,!0)),I)),Label$1.renderCallByParent(this.props,I))}}])}(React.Component);_defineProperty$9(ReferenceArea,"displayName","ReferenceArea"),_defineProperty$9(ReferenceArea,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1}),_defineProperty$9(ReferenceArea,"renderRect",function(t,e){var n;return React.isValidElement(t)?n=React.cloneElement(t,e):isFunction$4(t)?n=t(e):n=React.createElement(Rectangle,_extends$6({},e,{className:"recharts-reference-area-rect"})),n});function getEveryNthWithCondition(t,e,n){if(e<1)return[];if(e===1&&n===void 0)return t;for(var o=[],l=0;l<t.length;l+=e)o.push(t[l]);return o}function getAngledTickWidth(t,e,n){var o={width:t.width+e.width,height:t.height+e.height};return getAngledRectangleWidth(o,n)}function getTickBoundaries(t,e,n){var o=n==="width",l=t.x,d=t.y,f=t.width,g=t.height;return e===1?{start:o?l:d,end:o?l+f:d+g}:{start:o?l+f:d+g,end:o?l:d}}function isVisible(t,e,n,o,l){if(t*e<t*o||t*e>t*l)return!1;var d=n();return t*(e-t*d/2-o)>=0&&t*(e+t*d/2-l)<=0}function getNumberIntervalTicks(t,e){return getEveryNthWithCondition(t,e+1)}function getEquidistantTicks(t,e,n,o,l){for(var d=(o||[]).slice(),f=e.start,g=e.end,b=0,_=1,S=f,R=function(){var A=o==null?void 0:o[b];if(A===void 0)return{v:getEveryNthWithCondition(o,_)};var M=b,I,j=function(){return I===void 0&&(I=n(A,M)),I},q=A.coordinate,z=b===0||isVisible(t,q,j,S,g);z||(b=0,S=f,_+=1),z&&(S=q+t*(j()/2+l),b+=_)},C;_<=d.length;)if(C=R(),C)return C.v;return[]}function _typeof$8(t){"@babel/helpers - typeof";return _typeof$8=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$8(t)}function ownKeys$5(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(l){return Object.getOwnPropertyDescriptor(t,l).enumerable})),n.push.apply(n,o)}return n}function _objectSpread$5(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ownKeys$5(Object(n),!0).forEach(function(o){_defineProperty$8(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys$5(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function _defineProperty$8(t,e,n){return e=_toPropertyKey$8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _toPropertyKey$8(t){var e=_toPrimitive$8(t,"string");return _typeof$8(e)=="symbol"?e:e+""}function _toPrimitive$8(t,e){if(_typeof$8(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(_typeof$8(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function getTicksEnd(t,e,n,o,l){for(var d=(o||[]).slice(),f=d.length,g=e.start,b=e.end,_=function(C){var E=d[C],A,M=function(){return A===void 0&&(A=n(E,C)),A};if(C===f-1){var I=t*(E.coordinate+t*M()/2-b);d[C]=E=_objectSpread$5(_objectSpread$5({},E),{},{tickCoord:I>0?E.coordinate-I*t:E.coordinate})}else d[C]=E=_objectSpread$5(_objectSpread$5({},E),{},{tickCoord:E.coordinate});var j=isVisible(t,E.tickCoord,M,g,b);j&&(b=E.tickCoord-t*(M()/2+l),d[C]=_objectSpread$5(_objectSpread$5({},E),{},{isShow:!0}))},S=f-1;S>=0;S--)_(S);return d}function getTicksStart(t,e,n,o,l,d){var f=(o||[]).slice(),g=f.length,b=e.start,_=e.end;if(d){var S=o[g-1],R=n(S,g-1),C=t*(S.coordinate+t*R/2-_);f[g-1]=S=_objectSpread$5(_objectSpread$5({},S),{},{tickCoord:C>0?S.coordinate-C*t:S.coordinate});var E=isVisible(t,S.tickCoord,function(){return R},b,_);E&&(_=S.tickCoord-t*(R/2+l),f[g-1]=_objectSpread$5(_objectSpread$5({},S),{},{isShow:!0}))}for(var A=d?g-1:g,M=function(q){var z=f[q],Q,F=function(){return Q===void 0&&(Q=n(z,q)),Q};if(q===0){var V=t*(z.coordinate-t*F()/2-b);f[q]=z=_objectSpread$5(_objectSpread$5({},z),{},{tickCoord:V<0?z.coordinate-V*t:z.coordinate})}else f[q]=z=_objectSpread$5(_objectSpread$5({},z),{},{tickCoord:z.coordinate});var te=isVisible(t,z.tickCoord,F,b,_);te&&(b=z.tickCoord+t*(F()/2+l),f[q]=_objectSpread$5(_objectSpread$5({},z),{},{isShow:!0}))},I=0;I<A;I++)M(I);return f}function getTicks(t,e,n){var o=t.tick,l=t.ticks,d=t.viewBox,f=t.minTickGap,g=t.orientation,b=t.interval,_=t.tickFormatter,S=t.unit,R=t.angle;if(!l||!l.length||!o)return[];if(isNumber$2(b)||Global.isSsr)return getNumberIntervalTicks(l,typeof b=="number"&&isNumber$2(b)?b:0);var C=[],E=g==="top"||g==="bottom"?"width":"height",A=S&&E==="width"?getStringSize(S,{fontSize:e,letterSpacing:n}):{width:0,height:0},M=function(z,Q){var F=isFunction$4(_)?_(z.value,Q):z.value;return E==="width"?getAngledTickWidth(getStringSize(F,{fontSize:e,letterSpacing:n}),A,R):getStringSize(F,{fontSize:e,letterSpacing:n})[E]},I=l.length>=2?mathSign(l[1].coordinate-l[0].coordinate):1,j=getTickBoundaries(d,I,E);return b==="equidistantPreserveStart"?getEquidistantTicks(I,j,M,l,f):(b==="preserveStart"||b==="preserveStartEnd"?C=getTicksStart(I,j,M,l,f,b==="preserveStartEnd"):C=getTicksEnd(I,j,M,l,f),C.filter(function(q){return q.isShow}))}var _excluded$3=["viewBox"],_excluded2$3=["viewBox"],_excluded3=["ticks"];function _typeof$7(t){"@babel/helpers - typeof";return _typeof$7=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$7(t)}function _extends$5(){return _extends$5=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},_extends$5.apply(this,arguments)}function ownKeys$4(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(l){return Object.getOwnPropertyDescriptor(t,l).enumerable})),n.push.apply(n,o)}return n}function _objectSpread$4(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ownKeys$4(Object(n),!0).forEach(function(o){_defineProperty$7(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys$4(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function _objectWithoutProperties$3(t,e){if(t==null)return{};var n=_objectWithoutPropertiesLoose$3(t,e),o,l;if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(t);for(l=0;l<d.length;l++)o=d[l],!(e.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function _objectWithoutPropertiesLoose$3(t,e){if(t==null)return{};var n={};for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){if(e.indexOf(o)>=0)continue;n[o]=t[o]}return n}function _classCallCheck$5(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties$5(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,_toPropertyKey$7(o.key),o)}}function _createClass$5(t,e,n){return e&&_defineProperties$5(t.prototype,e),n&&_defineProperties$5(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function _callSuper$4(t,e,n){return e=_getPrototypeOf$4(e),_possibleConstructorReturn$4(t,_isNativeReflectConstruct$4()?Reflect.construct(e,n||[],_getPrototypeOf$4(t).constructor):e.apply(t,n))}function _possibleConstructorReturn$4(t,e){if(e&&(_typeof$7(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$4(t)}function _assertThisInitialized$4(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _isNativeReflectConstruct$4(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_isNativeReflectConstruct$4=function(){return!!t})()}function _getPrototypeOf$4(t){return _getPrototypeOf$4=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},_getPrototypeOf$4(t)}function _inherits$4(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf$4(t,e)}function _setPrototypeOf$4(t,e){return _setPrototypeOf$4=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,l){return o.__proto__=l,o},_setPrototypeOf$4(t,e)}function _defineProperty$7(t,e,n){return e=_toPropertyKey$7(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _toPropertyKey$7(t){var e=_toPrimitive$7(t,"string");return _typeof$7(e)=="symbol"?e:e+""}function _toPrimitive$7(t,e){if(_typeof$7(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(_typeof$7(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var CartesianAxis=function(t){function e(n){var o;return _classCallCheck$5(this,e),o=_callSuper$4(this,e,[n]),o.state={fontSize:"",letterSpacing:""},o}return _inherits$4(e,t),_createClass$5(e,[{key:"shouldComponentUpdate",value:function(o,l){var d=o.viewBox,f=_objectWithoutProperties$3(o,_excluded$3),g=this.props,b=g.viewBox,_=_objectWithoutProperties$3(g,_excluded2$3);return!shallowEqual(d,b)||!shallowEqual(f,_)||!shallowEqual(l,this.state)}},{key:"componentDidMount",value:function(){var o=this.layerReference;if(o){var l=o.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];l&&this.setState({fontSize:window.getComputedStyle(l).fontSize,letterSpacing:window.getComputedStyle(l).letterSpacing})}}},{key:"getTickLineCoord",value:function(o){var l=this.props,d=l.x,f=l.y,g=l.width,b=l.height,_=l.orientation,S=l.tickSize,R=l.mirror,C=l.tickMargin,E,A,M,I,j,q,z=R?-1:1,Q=o.tickSize||S,F=isNumber$2(o.tickCoord)?o.tickCoord:o.coordinate;switch(_){case"top":E=A=o.coordinate,I=f+ +!R*b,M=I-z*Q,q=M-z*C,j=F;break;case"left":M=I=o.coordinate,A=d+ +!R*g,E=A-z*Q,j=E-z*C,q=F;break;case"right":M=I=o.coordinate,A=d+ +R*g,E=A+z*Q,j=E+z*C,q=F;break;default:E=A=o.coordinate,I=f+ +R*b,M=I+z*Q,q=M+z*C,j=F;break}return{line:{x1:E,y1:M,x2:A,y2:I},tick:{x:j,y:q}}}},{key:"getTickTextAnchor",value:function(){var o=this.props,l=o.orientation,d=o.mirror,f;switch(l){case"left":f=d?"start":"end";break;case"right":f=d?"end":"start";break;default:f="middle";break}return f}},{key:"getTickVerticalAnchor",value:function(){var o=this.props,l=o.orientation,d=o.mirror,f="end";switch(l){case"left":case"right":f="middle";break;case"top":f=d?"start":"end";break;default:f=d?"end":"start";break}return f}},{key:"renderAxisLine",value:function(){var o=this.props,l=o.x,d=o.y,f=o.width,g=o.height,b=o.orientation,_=o.mirror,S=o.axisLine,R=_objectSpread$4(_objectSpread$4(_objectSpread$4({},filterProps(this.props,!1)),filterProps(S,!1)),{},{fill:"none"});if(b==="top"||b==="bottom"){var C=+(b==="top"&&!_||b==="bottom"&&_);R=_objectSpread$4(_objectSpread$4({},R),{},{x1:l,y1:d+C*g,x2:l+f,y2:d+C*g})}else{var E=+(b==="left"&&!_||b==="right"&&_);R=_objectSpread$4(_objectSpread$4({},R),{},{x1:l+E*f,y1:d,x2:l+E*f,y2:d+g})}return React.createElement("line",_extends$5({},R,{className:clsx("recharts-cartesian-axis-line",get$1(S,"className"))}))}},{key:"renderTicks",value:function(o,l,d){var f=this,g=this.props,b=g.tickLine,_=g.stroke,S=g.tick,R=g.tickFormatter,C=g.unit,E=getTicks(_objectSpread$4(_objectSpread$4({},this.props),{},{ticks:o}),l,d),A=this.getTickTextAnchor(),M=this.getTickVerticalAnchor(),I=filterProps(this.props,!1),j=filterProps(S,!1),q=_objectSpread$4(_objectSpread$4({},I),{},{fill:"none"},filterProps(b,!1)),z=E.map(function(Q,F){var V=f.getTickLineCoord(Q),te=V.line,ne=V.tick,se=_objectSpread$4(_objectSpread$4(_objectSpread$4(_objectSpread$4({textAnchor:A,verticalAnchor:M},I),{},{stroke:"none",fill:_},j),ne),{},{index:F,payload:Q,visibleTicksCount:E.length,tickFormatter:R});return React.createElement(Layer,_extends$5({className:"recharts-cartesian-axis-tick",key:"tick-".concat(Q.value,"-").concat(Q.coordinate,"-").concat(Q.tickCoord)},adaptEventsOfChild(f.props,Q,F)),b&&React.createElement("line",_extends$5({},q,te,{className:clsx("recharts-cartesian-axis-tick-line",get$1(b,"className"))})),S&&e.renderTickItem(S,se,"".concat(isFunction$4(R)?R(Q.value,F):Q.value).concat(C||"")))});return React.createElement("g",{className:"recharts-cartesian-axis-ticks"},z)}},{key:"render",value:function(){var o=this,l=this.props,d=l.axisLine,f=l.width,g=l.height,b=l.ticksGenerator,_=l.className,S=l.hide;if(S)return null;var R=this.props,C=R.ticks,E=_objectWithoutProperties$3(R,_excluded3),A=C;return isFunction$4(b)&&(A=C&&C.length>0?b(this.props):b(E)),f<=0||g<=0||!A||!A.length?null:React.createElement(Layer,{className:clsx("recharts-cartesian-axis",_),ref:function(I){o.layerReference=I}},d&&this.renderAxisLine(),this.renderTicks(A,this.state.fontSize,this.state.letterSpacing),Label$1.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(o,l,d){var f;return React.isValidElement(o)?f=React.cloneElement(o,l):isFunction$4(o)?f=o(l):f=React.createElement(Text$1,_extends$5({},l,{className:"recharts-cartesian-axis-tick-value"}),d),f}}])}(React.Component);_defineProperty$7(CartesianAxis,"displayName","CartesianAxis"),_defineProperty$7(CartesianAxis,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var _excluded$2=["x1","y1","x2","y2","key"],_excluded2$2=["offset"];function _typeof$6(t){"@babel/helpers - typeof";return _typeof$6=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$6(t)}function ownKeys$3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(l){return Object.getOwnPropertyDescriptor(t,l).enumerable})),n.push.apply(n,o)}return n}function _objectSpread$3(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ownKeys$3(Object(n),!0).forEach(function(o){_defineProperty$6(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys$3(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function _defineProperty$6(t,e,n){return e=_toPropertyKey$6(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _toPropertyKey$6(t){var e=_toPrimitive$6(t,"string");return _typeof$6(e)=="symbol"?e:e+""}function _toPrimitive$6(t,e){if(_typeof$6(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(_typeof$6(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function _extends$4(){return _extends$4=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},_extends$4.apply(this,arguments)}function _objectWithoutProperties$2(t,e){if(t==null)return{};var n=_objectWithoutPropertiesLoose$2(t,e),o,l;if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(t);for(l=0;l<d.length;l++)o=d[l],!(e.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function _objectWithoutPropertiesLoose$2(t,e){if(t==null)return{};var n={};for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){if(e.indexOf(o)>=0)continue;n[o]=t[o]}return n}var Background=function(e){var n=e.fill;if(!n||n==="none")return null;var o=e.fillOpacity,l=e.x,d=e.y,f=e.width,g=e.height,b=e.ry;return React.createElement("rect",{x:l,y:d,ry:b,width:f,height:g,stroke:"none",fill:n,fillOpacity:o,className:"recharts-cartesian-grid-bg"})};function renderLineItem(t,e){var n;if(React.isValidElement(t))n=React.cloneElement(t,e);else if(isFunction$4(t))n=t(e);else{var o=e.x1,l=e.y1,d=e.x2,f=e.y2,g=e.key,b=_objectWithoutProperties$2(e,_excluded$2),_=filterProps(b,!1);_.offset;var S=_objectWithoutProperties$2(_,_excluded2$2);n=React.createElement("line",_extends$4({},S,{x1:o,y1:l,x2:d,y2:f,fill:"none",key:g}))}return n}function HorizontalGridLines(t){var e=t.x,n=t.width,o=t.horizontal,l=o===void 0?!0:o,d=t.horizontalPoints;if(!l||!d||!d.length)return null;var f=d.map(function(g,b){var _=_objectSpread$3(_objectSpread$3({},t),{},{x1:e,y1:g,x2:e+n,y2:g,key:"line-".concat(b),index:b});return renderLineItem(l,_)});return React.createElement("g",{className:"recharts-cartesian-grid-horizontal"},f)}function VerticalGridLines(t){var e=t.y,n=t.height,o=t.vertical,l=o===void 0?!0:o,d=t.verticalPoints;if(!l||!d||!d.length)return null;var f=d.map(function(g,b){var _=_objectSpread$3(_objectSpread$3({},t),{},{x1:g,y1:e,x2:g,y2:e+n,key:"line-".concat(b),index:b});return renderLineItem(l,_)});return React.createElement("g",{className:"recharts-cartesian-grid-vertical"},f)}function HorizontalStripes(t){var e=t.horizontalFill,n=t.fillOpacity,o=t.x,l=t.y,d=t.width,f=t.height,g=t.horizontalPoints,b=t.horizontal,_=b===void 0?!0:b;if(!_||!e||!e.length)return null;var S=g.map(function(C){return Math.round(C+l-l)}).sort(function(C,E){return C-E});l!==S[0]&&S.unshift(0);var R=S.map(function(C,E){var A=!S[E+1],M=A?l+f-C:S[E+1]-C;if(M<=0)return null;var I=E%e.length;return React.createElement("rect",{key:"react-".concat(E),y:C,x:o,height:M,width:d,stroke:"none",fill:e[I],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return React.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},R)}function VerticalStripes(t){var e=t.vertical,n=e===void 0?!0:e,o=t.verticalFill,l=t.fillOpacity,d=t.x,f=t.y,g=t.width,b=t.height,_=t.verticalPoints;if(!n||!o||!o.length)return null;var S=_.map(function(C){return Math.round(C+d-d)}).sort(function(C,E){return C-E});d!==S[0]&&S.unshift(0);var R=S.map(function(C,E){var A=!S[E+1],M=A?d+g-C:S[E+1]-C;if(M<=0)return null;var I=E%o.length;return React.createElement("rect",{key:"react-".concat(E),x:C,y:f,width:M,height:b,stroke:"none",fill:o[I],fillOpacity:l,className:"recharts-cartesian-grid-bg"})});return React.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},R)}var defaultVerticalCoordinatesGenerator=function(e,n){var o=e.xAxis,l=e.width,d=e.height,f=e.offset;return getCoordinatesOfGrid(getTicks(_objectSpread$3(_objectSpread$3(_objectSpread$3({},CartesianAxis.defaultProps),o),{},{ticks:getTicksOfAxis(o,!0),viewBox:{x:0,y:0,width:l,height:d}})),f.left,f.left+f.width,n)},defaultHorizontalCoordinatesGenerator=function(e,n){var o=e.yAxis,l=e.width,d=e.height,f=e.offset;return getCoordinatesOfGrid(getTicks(_objectSpread$3(_objectSpread$3(_objectSpread$3({},CartesianAxis.defaultProps),o),{},{ticks:getTicksOfAxis(o,!0),viewBox:{x:0,y:0,width:l,height:d}})),f.top,f.top+f.height,n)},defaultProps={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function CartesianGrid(t){var e,n,o,l,d,f,g=useChartWidth(),b=useChartHeight(),_=useOffset(),S=_objectSpread$3(_objectSpread$3({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:defaultProps.stroke,fill:(n=t.fill)!==null&&n!==void 0?n:defaultProps.fill,horizontal:(o=t.horizontal)!==null&&o!==void 0?o:defaultProps.horizontal,horizontalFill:(l=t.horizontalFill)!==null&&l!==void 0?l:defaultProps.horizontalFill,vertical:(d=t.vertical)!==null&&d!==void 0?d:defaultProps.vertical,verticalFill:(f=t.verticalFill)!==null&&f!==void 0?f:defaultProps.verticalFill,x:isNumber$2(t.x)?t.x:_.left,y:isNumber$2(t.y)?t.y:_.top,width:isNumber$2(t.width)?t.width:_.width,height:isNumber$2(t.height)?t.height:_.height}),R=S.x,C=S.y,E=S.width,A=S.height,M=S.syncWithTicks,I=S.horizontalValues,j=S.verticalValues,q=useArbitraryXAxis(),z=useYAxisWithFiniteDomainOrRandom();if(!isNumber$2(E)||E<=0||!isNumber$2(A)||A<=0||!isNumber$2(R)||R!==+R||!isNumber$2(C)||C!==+C)return null;var Q=S.verticalCoordinatesGenerator||defaultVerticalCoordinatesGenerator,F=S.horizontalCoordinatesGenerator||defaultHorizontalCoordinatesGenerator,V=S.horizontalPoints,te=S.verticalPoints;if((!V||!V.length)&&isFunction$4(F)){var ne=I&&I.length,se=F({yAxis:z?_objectSpread$3(_objectSpread$3({},z),{},{ticks:ne?I:z.ticks}):void 0,width:g,height:b,offset:_},ne?!0:M);warn$1(Array.isArray(se),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(_typeof$6(se),"]")),Array.isArray(se)&&(V=se)}if((!te||!te.length)&&isFunction$4(Q)){var ge=j&&j.length,oe=Q({xAxis:q?_objectSpread$3(_objectSpread$3({},q),{},{ticks:ge?j:q.ticks}):void 0,width:g,height:b,offset:_},ge?!0:M);warn$1(Array.isArray(oe),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(_typeof$6(oe),"]")),Array.isArray(oe)&&(te=oe)}return React.createElement("g",{className:"recharts-cartesian-grid"},React.createElement(Background,{fill:S.fill,fillOpacity:S.fillOpacity,x:S.x,y:S.y,width:S.width,height:S.height,ry:S.ry}),React.createElement(HorizontalGridLines,_extends$4({},S,{offset:_,horizontalPoints:V,xAxis:q,yAxis:z})),React.createElement(VerticalGridLines,_extends$4({},S,{offset:_,verticalPoints:te,xAxis:q,yAxis:z})),React.createElement(HorizontalStripes,_extends$4({},S,{horizontalPoints:V})),React.createElement(VerticalStripes,_extends$4({},S,{verticalPoints:te})))}CartesianGrid.displayName="CartesianGrid";var _excluded$1=["layout","type","stroke","connectNulls","isRange","ref"],_excluded2$1=["key"],_Area;function _typeof$5(t){"@babel/helpers - typeof";return _typeof$5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$5(t)}function _objectWithoutProperties$1(t,e){if(t==null)return{};var n=_objectWithoutPropertiesLoose$1(t,e),o,l;if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(t);for(l=0;l<d.length;l++)o=d[l],!(e.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function _objectWithoutPropertiesLoose$1(t,e){if(t==null)return{};var n={};for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){if(e.indexOf(o)>=0)continue;n[o]=t[o]}return n}function _extends$3(){return _extends$3=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},_extends$3.apply(this,arguments)}function ownKeys$2(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(l){return Object.getOwnPropertyDescriptor(t,l).enumerable})),n.push.apply(n,o)}return n}function _objectSpread$2(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ownKeys$2(Object(n),!0).forEach(function(o){_defineProperty$5(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys$2(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function _classCallCheck$4(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties$4(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,_toPropertyKey$5(o.key),o)}}function _createClass$4(t,e,n){return e&&_defineProperties$4(t.prototype,e),n&&_defineProperties$4(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function _callSuper$3(t,e,n){return e=_getPrototypeOf$3(e),_possibleConstructorReturn$3(t,_isNativeReflectConstruct$3()?Reflect.construct(e,n||[],_getPrototypeOf$3(t).constructor):e.apply(t,n))}function _possibleConstructorReturn$3(t,e){if(e&&(_typeof$5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$3(t)}function _assertThisInitialized$3(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _isNativeReflectConstruct$3(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_isNativeReflectConstruct$3=function(){return!!t})()}function _getPrototypeOf$3(t){return _getPrototypeOf$3=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},_getPrototypeOf$3(t)}function _inherits$3(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf$3(t,e)}function _setPrototypeOf$3(t,e){return _setPrototypeOf$3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,l){return o.__proto__=l,o},_setPrototypeOf$3(t,e)}function _defineProperty$5(t,e,n){return e=_toPropertyKey$5(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _toPropertyKey$5(t){var e=_toPrimitive$5(t,"string");return _typeof$5(e)=="symbol"?e:e+""}function _toPrimitive$5(t,e){if(_typeof$5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(_typeof$5(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Area=function(t){function e(){var n;_classCallCheck$4(this,e);for(var o=arguments.length,l=new Array(o),d=0;d<o;d++)l[d]=arguments[d];return n=_callSuper$3(this,e,[].concat(l)),_defineProperty$5(n,"state",{isAnimationFinished:!0}),_defineProperty$5(n,"id",uniqueId("recharts-area-")),_defineProperty$5(n,"handleAnimationEnd",function(){var f=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),isFunction$4(f)&&f()}),_defineProperty$5(n,"handleAnimationStart",function(){var f=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),isFunction$4(f)&&f()}),n}return _inherits$3(e,t),_createClass$4(e,[{key:"renderDots",value:function(o,l,d){var f=this.props.isAnimationActive,g=this.state.isAnimationFinished;if(f&&!g)return null;var b=this.props,_=b.dot,S=b.points,R=b.dataKey,C=filterProps(this.props,!1),E=filterProps(_,!0),A=S.map(function(I,j){var q=_objectSpread$2(_objectSpread$2(_objectSpread$2({key:"dot-".concat(j),r:3},C),E),{},{index:j,cx:I.x,cy:I.y,dataKey:R,value:I.value,payload:I.payload,points:S});return e.renderDotItem(_,q)}),M={clipPath:o?"url(#clipPath-".concat(l?"":"dots-").concat(d,")"):null};return React.createElement(Layer,_extends$3({className:"recharts-area-dots"},M),A)}},{key:"renderHorizontalRect",value:function(o){var l=this.props,d=l.baseLine,f=l.points,g=l.strokeWidth,b=f[0].x,_=f[f.length-1].x,S=o*Math.abs(b-_),R=max$1(f.map(function(C){return C.y||0}));return isNumber$2(d)&&typeof d=="number"?R=Math.max(d,R):d&&Array.isArray(d)&&d.length&&(R=Math.max(max$1(d.map(function(C){return C.y||0})),R)),isNumber$2(R)?React.createElement("rect",{x:b<_?b:b-S,y:0,width:S,height:Math.floor(R+(g?parseInt("".concat(g),10):1))}):null}},{key:"renderVerticalRect",value:function(o){var l=this.props,d=l.baseLine,f=l.points,g=l.strokeWidth,b=f[0].y,_=f[f.length-1].y,S=o*Math.abs(b-_),R=max$1(f.map(function(C){return C.x||0}));return isNumber$2(d)&&typeof d=="number"?R=Math.max(d,R):d&&Array.isArray(d)&&d.length&&(R=Math.max(max$1(d.map(function(C){return C.x||0})),R)),isNumber$2(R)?React.createElement("rect",{x:0,y:b<_?b:b-S,width:R+(g?parseInt("".concat(g),10):1),height:Math.floor(S)}):null}},{key:"renderClipRect",value:function(o){var l=this.props.layout;return l==="vertical"?this.renderVerticalRect(o):this.renderHorizontalRect(o)}},{key:"renderAreaStatically",value:function(o,l,d,f){var g=this.props,b=g.layout,_=g.type,S=g.stroke,R=g.connectNulls,C=g.isRange;g.ref;var E=_objectWithoutProperties$1(g,_excluded$1);return React.createElement(Layer,{clipPath:d?"url(#clipPath-".concat(f,")"):null},React.createElement(Curve,_extends$3({},filterProps(E,!0),{points:o,connectNulls:R,type:_,baseLine:l,layout:b,stroke:"none",className:"recharts-area-area"})),S!=="none"&&React.createElement(Curve,_extends$3({},filterProps(this.props,!1),{className:"recharts-area-curve",layout:b,type:_,connectNulls:R,fill:"none",points:o})),S!=="none"&&C&&React.createElement(Curve,_extends$3({},filterProps(this.props,!1),{className:"recharts-area-curve",layout:b,type:_,connectNulls:R,fill:"none",points:l})))}},{key:"renderAreaWithAnimation",value:function(o,l){var d=this,f=this.props,g=f.points,b=f.baseLine,_=f.isAnimationActive,S=f.animationBegin,R=f.animationDuration,C=f.animationEasing,E=f.animationId,A=this.state,M=A.prevPoints,I=A.prevBaseLine;return React.createElement(Animate,{begin:S,duration:R,isActive:_,easing:C,from:{t:0},to:{t:1},key:"area-".concat(E),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(j){var q=j.t;if(M){var z=M.length/g.length,Q=g.map(function(ne,se){var ge=Math.floor(se*z);if(M[ge]){var oe=M[ge],Ae=interpolateNumber$2(oe.x,ne.x),je=interpolateNumber$2(oe.y,ne.y);return _objectSpread$2(_objectSpread$2({},ne),{},{x:Ae(q),y:je(q)})}return ne}),F;if(isNumber$2(b)&&typeof b=="number"){var V=interpolateNumber$2(I,b);F=V(q)}else if(isNil(b)||isNan(b)){var te=interpolateNumber$2(I,0);F=te(q)}else F=b.map(function(ne,se){var ge=Math.floor(se*z);if(I[ge]){var oe=I[ge],Ae=interpolateNumber$2(oe.x,ne.x),je=interpolateNumber$2(oe.y,ne.y);return _objectSpread$2(_objectSpread$2({},ne),{},{x:Ae(q),y:je(q)})}return ne});return d.renderAreaStatically(Q,F,o,l)}return React.createElement(Layer,null,React.createElement("defs",null,React.createElement("clipPath",{id:"animationClipPath-".concat(l)},d.renderClipRect(q))),React.createElement(Layer,{clipPath:"url(#animationClipPath-".concat(l,")")},d.renderAreaStatically(g,b,o,l)))})}},{key:"renderArea",value:function(o,l){var d=this.props,f=d.points,g=d.baseLine,b=d.isAnimationActive,_=this.state,S=_.prevPoints,R=_.prevBaseLine,C=_.totalLength;return b&&f&&f.length&&(!S&&C>0||!isEqual(S,f)||!isEqual(R,g))?this.renderAreaWithAnimation(o,l):this.renderAreaStatically(f,g,o,l)}},{key:"render",value:function(){var o,l=this.props,d=l.hide,f=l.dot,g=l.points,b=l.className,_=l.top,S=l.left,R=l.xAxis,C=l.yAxis,E=l.width,A=l.height,M=l.isAnimationActive,I=l.id;if(d||!g||!g.length)return null;var j=this.state.isAnimationFinished,q=g.length===1,z=clsx("recharts-area",b),Q=R&&R.allowDataOverflow,F=C&&C.allowDataOverflow,V=Q||F,te=isNil(I)?this.id:I,ne=(o=filterProps(f,!1))!==null&&o!==void 0?o:{r:3,strokeWidth:2},se=ne.r,ge=se===void 0?3:se,oe=ne.strokeWidth,Ae=oe===void 0?2:oe,je=hasClipDot(f)?f:{},Ne=je.clipDot,Oe=Ne===void 0?!0:Ne,Fe=ge*2+Ae;return React.createElement(Layer,{className:z},Q||F?React.createElement("defs",null,React.createElement("clipPath",{id:"clipPath-".concat(te)},React.createElement("rect",{x:Q?S:S-E/2,y:F?_:_-A/2,width:Q?E:E*2,height:F?A:A*2})),!Oe&&React.createElement("clipPath",{id:"clipPath-dots-".concat(te)},React.createElement("rect",{x:S-Fe/2,y:_-Fe/2,width:E+Fe,height:A+Fe}))):null,q?null:this.renderArea(V,te),(f||q)&&this.renderDots(V,Oe,te),(!M||j)&&LabelList.renderCallByParent(this.props,g))}}],[{key:"getDerivedStateFromProps",value:function(o,l){return o.animationId!==l.prevAnimationId?{prevAnimationId:o.animationId,curPoints:o.points,curBaseLine:o.baseLine,prevPoints:l.curPoints,prevBaseLine:l.curBaseLine}:o.points!==l.curPoints||o.baseLine!==l.curBaseLine?{curPoints:o.points,curBaseLine:o.baseLine}:null}}])}(React.PureComponent);_Area=Area,_defineProperty$5(Area,"displayName","Area"),_defineProperty$5(Area,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!Global.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"}),_defineProperty$5(Area,"getBaseValue",function(t,e,n,o){var l=t.layout,d=t.baseValue,f=e.props.baseValue,g=f??d;if(isNumber$2(g)&&typeof g=="number")return g;var b=l==="horizontal"?o:n,_=b.scale.domain();if(b.type==="number"){var S=Math.max(_[0],_[1]),R=Math.min(_[0],_[1]);return g==="dataMin"?R:g==="dataMax"||S<0?S:Math.max(Math.min(_[0],_[1]),0)}return g==="dataMin"?_[0]:g==="dataMax"?_[1]:_[0]}),_defineProperty$5(Area,"getComposedData",function(t){var e=t.props,n=t.item,o=t.xAxis,l=t.yAxis,d=t.xAxisTicks,f=t.yAxisTicks,g=t.bandSize,b=t.dataKey,_=t.stackedData,S=t.dataStartIndex,R=t.displayedData,C=t.offset,E=e.layout,A=_&&_.length,M=_Area.getBaseValue(e,n,o,l),I=E==="horizontal",j=!1,q=R.map(function(Q,F){var V;A?V=_[S+F]:(V=getValueByDataKey(Q,b),Array.isArray(V)?j=!0:V=[M,V]);var te=V[1]==null||A&&getValueByDataKey(Q,b)==null;return I?{x:getCateCoordinateOfLine({axis:o,ticks:d,bandSize:g,entry:Q,index:F}),y:te?null:l.scale(V[1]),value:V,payload:Q}:{x:te?null:o.scale(V[1]),y:getCateCoordinateOfLine({axis:l,ticks:f,bandSize:g,entry:Q,index:F}),value:V,payload:Q}}),z;return A||j?z=q.map(function(Q){var F=Array.isArray(Q.value)?Q.value[0]:null;return I?{x:Q.x,y:F!=null&&Q.y!=null?l.scale(F):null}:{x:F!=null?o.scale(F):null,y:Q.y}}):z=I?l.scale(M):o.scale(M),_objectSpread$2({points:q,baseLine:z,layout:E,isRange:j},C)}),_defineProperty$5(Area,"renderDotItem",function(t,e){var n;if(React.isValidElement(t))n=React.cloneElement(t,e);else if(isFunction$4(t))n=t(e);else{var o=clsx("recharts-area-dot",typeof t!="boolean"?t.className:""),l=e.key,d=_objectWithoutProperties$1(e,_excluded2$1);n=React.createElement(Dot,_extends$3({},d,{key:l,className:o}))}return n});function _typeof$4(t){"@babel/helpers - typeof";return _typeof$4=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$4(t)}function _classCallCheck$3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties$3(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,_toPropertyKey$4(o.key),o)}}function _createClass$3(t,e,n){return e&&_defineProperties$3(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function _callSuper$2(t,e,n){return e=_getPrototypeOf$2(e),_possibleConstructorReturn$2(t,_isNativeReflectConstruct$2()?Reflect.construct(e,n||[],_getPrototypeOf$2(t).constructor):e.apply(t,n))}function _possibleConstructorReturn$2(t,e){if(e&&(_typeof$4(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$2(t)}function _assertThisInitialized$2(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _isNativeReflectConstruct$2(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_isNativeReflectConstruct$2=function(){return!!t})()}function _getPrototypeOf$2(t){return _getPrototypeOf$2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},_getPrototypeOf$2(t)}function _inherits$2(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf$2(t,e)}function _setPrototypeOf$2(t,e){return _setPrototypeOf$2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,l){return o.__proto__=l,o},_setPrototypeOf$2(t,e)}function _defineProperty$4(t,e,n){return e=_toPropertyKey$4(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _toPropertyKey$4(t){var e=_toPrimitive$4(t,"string");return _typeof$4(e)=="symbol"?e:e+""}function _toPrimitive$4(t,e){if(_typeof$4(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(_typeof$4(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function _extends$2(){return _extends$2=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},_extends$2.apply(this,arguments)}function XAxisImpl(t){var e=t.xAxisId,n=useChartWidth(),o=useChartHeight(),l=useXAxisOrThrow(e);return l==null?null:React.createElement(CartesianAxis,_extends$2({},l,{className:clsx("recharts-".concat(l.axisType," ").concat(l.axisType),l.className),viewBox:{x:0,y:0,width:n,height:o},ticksGenerator:function(f){return getTicksOfAxis(f,!0)}}))}var XAxis=function(t){function e(){return _classCallCheck$3(this,e),_callSuper$2(this,e,arguments)}return _inherits$2(e,t),_createClass$3(e,[{key:"render",value:function(){return React.createElement(XAxisImpl,this.props)}}])}(React.Component);_defineProperty$4(XAxis,"displayName","XAxis"),_defineProperty$4(XAxis,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function _typeof$3(t){"@babel/helpers - typeof";return _typeof$3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$3(t)}function _classCallCheck$2(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties$2(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,_toPropertyKey$3(o.key),o)}}function _createClass$2(t,e,n){return e&&_defineProperties$2(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function _callSuper$1(t,e,n){return e=_getPrototypeOf$1(e),_possibleConstructorReturn$1(t,_isNativeReflectConstruct$1()?Reflect.construct(e,n||[],_getPrototypeOf$1(t).constructor):e.apply(t,n))}function _possibleConstructorReturn$1(t,e){if(e&&(_typeof$3(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$1(t)}function _assertThisInitialized$1(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _isNativeReflectConstruct$1(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_isNativeReflectConstruct$1=function(){return!!t})()}function _getPrototypeOf$1(t){return _getPrototypeOf$1=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},_getPrototypeOf$1(t)}function _inherits$1(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf$1(t,e)}function _setPrototypeOf$1(t,e){return _setPrototypeOf$1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,l){return o.__proto__=l,o},_setPrototypeOf$1(t,e)}function _defineProperty$3(t,e,n){return e=_toPropertyKey$3(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _toPropertyKey$3(t){var e=_toPrimitive$3(t,"string");return _typeof$3(e)=="symbol"?e:e+""}function _toPrimitive$3(t,e){if(_typeof$3(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(_typeof$3(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function _extends$1(){return _extends$1=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},_extends$1.apply(this,arguments)}var YAxisImpl=function(e){var n=e.yAxisId,o=useChartWidth(),l=useChartHeight(),d=useYAxisOrThrow(n);return d==null?null:React.createElement(CartesianAxis,_extends$1({},d,{className:clsx("recharts-".concat(d.axisType," ").concat(d.axisType),d.className),viewBox:{x:0,y:0,width:o,height:l},ticksGenerator:function(g){return getTicksOfAxis(g,!0)}}))},YAxis=function(t){function e(){return _classCallCheck$2(this,e),_callSuper$1(this,e,arguments)}return _inherits$1(e,t),_createClass$2(e,[{key:"render",value:function(){return React.createElement(YAxisImpl,this.props)}}])}(React.Component);_defineProperty$3(YAxis,"displayName","YAxis"),_defineProperty$3(YAxis,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function _toConsumableArray$1(t){return _arrayWithoutHoles$1(t)||_iterableToArray$1(t)||_unsupportedIterableToArray$1(t)||_nonIterableSpread$1()}function _nonIterableSpread$1(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
594
594
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray$1(t,e){if(t){if(typeof t=="string")return _arrayLikeToArray$1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray$1(t,e)}}function _iterableToArray$1(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function _arrayWithoutHoles$1(t){if(Array.isArray(t))return _arrayLikeToArray$1(t)}function _arrayLikeToArray$1(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}var detectReferenceElementsDomain=function(e,n,o,l,d){var f=findAllByType(e,ReferenceLine),g=findAllByType(e,ReferenceDot),b=[].concat(_toConsumableArray$1(f),_toConsumableArray$1(g)),_=findAllByType(e,ReferenceArea),S="".concat(l,"Id"),R=l[0],C=n;if(b.length&&(C=b.reduce(function(M,I){if(I.props[S]===o&&ifOverflowMatches(I.props,"extendDomain")&&isNumber$2(I.props[R])){var j=I.props[R];return[Math.min(M[0],j),Math.max(M[1],j)]}return M},C)),_.length){var E="".concat(R,"1"),A="".concat(R,"2");C=_.reduce(function(M,I){if(I.props[S]===o&&ifOverflowMatches(I.props,"extendDomain")&&isNumber$2(I.props[E])&&isNumber$2(I.props[A])){var j=I.props[E],q=I.props[A];return[Math.min(M[0],j,q),Math.max(M[1],j,q)]}return M},C)}return d&&d.length&&(C=d.reduce(function(M,I){return isNumber$2(I)?[Math.min(M[0],I),Math.max(M[1],I)]:M},C)),C},eventemitter3={exports:{}},hasRequiredEventemitter3;function requireEventemitter3(){return hasRequiredEventemitter3||(hasRequiredEventemitter3=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function o(){}Object.create&&(o.prototype=Object.create(null),new o().__proto__||(n=!1));function l(b,_,S){this.fn=b,this.context=_,this.once=S||!1}function d(b,_,S,R,C){if(typeof S!="function")throw new TypeError("The listener must be a function");var E=new l(S,R||b,C),A=n?n+_:_;return b._events[A]?b._events[A].fn?b._events[A]=[b._events[A],E]:b._events[A].push(E):(b._events[A]=E,b._eventsCount++),b}function f(b,_){--b._eventsCount===0?b._events=new o:delete b._events[_]}function g(){this._events=new o,this._eventsCount=0}g.prototype.eventNames=function(){var _=[],S,R;if(this._eventsCount===0)return _;for(R in S=this._events)e.call(S,R)&&_.push(n?R.slice(1):R);return Object.getOwnPropertySymbols?_.concat(Object.getOwnPropertySymbols(S)):_},g.prototype.listeners=function(_){var S=n?n+_:_,R=this._events[S];if(!R)return[];if(R.fn)return[R.fn];for(var C=0,E=R.length,A=new Array(E);C<E;C++)A[C]=R[C].fn;return A},g.prototype.listenerCount=function(_){var S=n?n+_:_,R=this._events[S];return R?R.fn?1:R.length:0},g.prototype.emit=function(_,S,R,C,E,A){var M=n?n+_:_;if(!this._events[M])return!1;var I=this._events[M],j=arguments.length,q,z;if(I.fn){switch(I.once&&this.removeListener(_,I.fn,void 0,!0),j){case 1:return I.fn.call(I.context),!0;case 2:return I.fn.call(I.context,S),!0;case 3:return I.fn.call(I.context,S,R),!0;case 4:return I.fn.call(I.context,S,R,C),!0;case 5:return I.fn.call(I.context,S,R,C,E),!0;case 6:return I.fn.call(I.context,S,R,C,E,A),!0}for(z=1,q=new Array(j-1);z<j;z++)q[z-1]=arguments[z];I.fn.apply(I.context,q)}else{var Q=I.length,F;for(z=0;z<Q;z++)switch(I[z].once&&this.removeListener(_,I[z].fn,void 0,!0),j){case 1:I[z].fn.call(I[z].context);break;case 2:I[z].fn.call(I[z].context,S);break;case 3:I[z].fn.call(I[z].context,S,R);break;case 4:I[z].fn.call(I[z].context,S,R,C);break;default:if(!q)for(F=1,q=new Array(j-1);F<j;F++)q[F-1]=arguments[F];I[z].fn.apply(I[z].context,q)}}return!0},g.prototype.on=function(_,S,R){return d(this,_,S,R,!1)},g.prototype.once=function(_,S,R){return d(this,_,S,R,!0)},g.prototype.removeListener=function(_,S,R,C){var E=n?n+_:_;if(!this._events[E])return this;if(!S)return f(this,E),this;var A=this._events[E];if(A.fn)A.fn===S&&(!C||A.once)&&(!R||A.context===R)&&f(this,E);else{for(var M=0,I=[],j=A.length;M<j;M++)(A[M].fn!==S||C&&!A[M].once||R&&A[M].context!==R)&&I.push(A[M]);I.length?this._events[E]=I.length===1?I[0]:I:f(this,E)}return this},g.prototype.removeAllListeners=function(_){var S;return _?(S=n?n+_:_,this._events[S]&&f(this,S)):(this._events=new o,this._eventsCount=0),this},g.prototype.off=g.prototype.removeListener,g.prototype.addListener=g.prototype.on,g.prefixed=n,g.EventEmitter=g,t.exports=g}(eventemitter3)),eventemitter3.exports}var eventemitter3Exports=requireEventemitter3();const EventEmitter$1=getDefaultExportFromCjs$1(eventemitter3Exports);var eventCenter=new EventEmitter$1,SYNC_EVENT="recharts.syncMouseEvents";function _typeof$2(t){"@babel/helpers - typeof";return _typeof$2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$2(t)}function _classCallCheck$1(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties$1(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,_toPropertyKey$2(o.key),o)}}function _createClass$1(t,e,n){return e&&_defineProperties$1(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function _defineProperty$2(t,e,n){return e=_toPropertyKey$2(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _toPropertyKey$2(t){var e=_toPrimitive$2(t,"string");return _typeof$2(e)=="symbol"?e:e+""}function _toPrimitive$2(t,e){if(_typeof$2(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(_typeof$2(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var AccessibilityManager=function(){function t(){_classCallCheck$1(this,t),_defineProperty$2(this,"activeIndex",0),_defineProperty$2(this,"coordinateList",[]),_defineProperty$2(this,"layout","horizontal")}return _createClass$1(t,[{key:"setDetails",value:function(n){var o,l=n.coordinateList,d=l===void 0?null:l,f=n.container,g=f===void 0?null:f,b=n.layout,_=b===void 0?null:b,S=n.offset,R=S===void 0?null:S,C=n.mouseHandlerCallback,E=C===void 0?null:C;this.coordinateList=(o=d??this.coordinateList)!==null&&o!==void 0?o:[],this.container=g??this.container,this.layout=_??this.layout,this.offset=R??this.offset,this.mouseHandlerCallback=E??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(n){if(this.coordinateList.length!==0)switch(n.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(n){this.activeIndex=n}},{key:"spoofMouse",value:function(){var n,o;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var l=this.container.getBoundingClientRect(),d=l.x,f=l.y,g=l.height,b=this.coordinateList[this.activeIndex].coordinate,_=((n=window)===null||n===void 0?void 0:n.scrollX)||0,S=((o=window)===null||o===void 0?void 0:o.scrollY)||0,R=d+b+_,C=f+this.offset.top+g/2+S;this.mouseHandlerCallback({pageX:R,pageY:C})}}}])}();function isDomainSpecifiedByUser(t,e,n){if(n==="number"&&e===!0&&Array.isArray(t)){var o=t==null?void 0:t[0],l=t==null?void 0:t[1];if(o&&l&&isNumber$2(o)&&isNumber$2(l))return!0}return!1}function getCursorRectangle(t,e,n,o){var l=o/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-l:n.left+.5,y:t==="horizontal"?n.top+.5:e.y-l,width:t==="horizontal"?o:n.width-1,height:t==="horizontal"?n.height-1:o}}function getRadialCursorPoints(t){var e=t.cx,n=t.cy,o=t.radius,l=t.startAngle,d=t.endAngle,f=polarToCartesian(e,n,o,l),g=polarToCartesian(e,n,o,d);return{points:[f,g],cx:e,cy:n,radius:o,startAngle:l,endAngle:d}}function getCursorPoints(t,e,n){var o,l,d,f;if(t==="horizontal")o=e.x,d=o,l=n.top,f=n.top+n.height;else if(t==="vertical")l=e.y,f=l,o=n.left,d=n.left+n.width;else if(e.cx!=null&&e.cy!=null)if(t==="centric"){var g=e.cx,b=e.cy,_=e.innerRadius,S=e.outerRadius,R=e.angle,C=polarToCartesian(g,b,_,R),E=polarToCartesian(g,b,S,R);o=C.x,l=C.y,d=E.x,f=E.y}else return getRadialCursorPoints(e);return[{x:o,y:l},{x:d,y:f}]}function _typeof$1(t){"@babel/helpers - typeof";return _typeof$1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$1(t)}function ownKeys$1(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(l){return Object.getOwnPropertyDescriptor(t,l).enumerable})),n.push.apply(n,o)}return n}function _objectSpread$1(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ownKeys$1(Object(n),!0).forEach(function(o){_defineProperty$1(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys$1(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function _defineProperty$1(t,e,n){return e=_toPropertyKey$1(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _toPropertyKey$1(t){var e=_toPrimitive$1(t,"string");return _typeof$1(e)=="symbol"?e:e+""}function _toPrimitive$1(t,e){if(_typeof$1(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(_typeof$1(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Cursor(t){var e,n,o=t.element,l=t.tooltipEventType,d=t.isActive,f=t.activeCoordinate,g=t.activePayload,b=t.offset,_=t.activeTooltipIndex,S=t.tooltipAxisBandSize,R=t.layout,C=t.chartName,E=(e=o.props.cursor)!==null&&e!==void 0?e:(n=o.type.defaultProps)===null||n===void 0?void 0:n.cursor;if(!o||!E||!d||!f||C!=="ScatterChart"&&l!=="axis")return null;var A,M=Curve;if(C==="ScatterChart")A=f,M=Cross;else if(C==="BarChart")A=getCursorRectangle(R,f,b,S),M=Rectangle;else if(R==="radial"){var I=getRadialCursorPoints(f),j=I.cx,q=I.cy,z=I.radius,Q=I.startAngle,F=I.endAngle;A={cx:j,cy:q,startAngle:Q,endAngle:F,innerRadius:z,outerRadius:z},M=Sector}else A={points:getCursorPoints(R,f,b)},M=Curve;var V=_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1({stroke:"#ccc",pointerEvents:"none"},b),A),filterProps(E,!1)),{},{payload:g,payloadIndex:_,className:clsx("recharts-tooltip-cursor",E.className)});return React.isValidElement(E)?React.cloneElement(E,V):React.createElement(M,V)}var _excluded=["item"],_excluded2=["children","className","width","height","style","compact","title","desc"];function _typeof(t){"@babel/helpers - typeof";return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(t)}function _extends(){return _extends=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},_extends.apply(this,arguments)}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
595
595
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _iterableToArrayLimit(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var o,l,d,f,g=[],b=!0,_=!1;try{if(d=(n=n.call(t)).next,e!==0)for(;!(b=(o=d.call(n)).done)&&(g.push(o.value),g.length!==e);b=!0);}catch(S){_=!0,l=S}finally{try{if(!b&&n.return!=null&&(f=n.return(),Object(f)!==f))return}finally{if(_)throw l}}return g}}function _arrayWithHoles(t){if(Array.isArray(t))return t}function _objectWithoutProperties(t,e){if(t==null)return{};var n=_objectWithoutPropertiesLoose(t,e),o,l;if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(t);for(l=0;l<d.length;l++)o=d[l],!(e.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function _objectWithoutPropertiesLoose(t,e){if(t==null)return{};var n={};for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){if(e.indexOf(o)>=0)continue;n[o]=t[o]}return n}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,_toPropertyKey(o.key),o)}}function _createClass(t,e,n){return e&&_defineProperties(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function _callSuper(t,e,n){return e=_getPrototypeOf(e),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(e,n||[],_getPrototypeOf(t).constructor):e.apply(t,n))}function _possibleConstructorReturn(t,e){if(e&&(_typeof(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_isNativeReflectConstruct=function(){return!!t})()}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},_getPrototypeOf(t)}function _inherits(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e)}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,l){return o.__proto__=l,o},_setPrototypeOf(t,e)}function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
596
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray(t,e){if(t){if(typeof t=="string")return _arrayLikeToArray(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(t,e)}}function _iterableToArray(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _arrayLikeToArray(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function ownKeys(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(l){return Object.getOwnPropertyDescriptor(t,l).enumerable})),n.push.apply(n,o)}return n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ownKeys(Object(n),!0).forEach(function(o){_defineProperty(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function _defineProperty(t,e,n){return e=_toPropertyKey(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _toPropertyKey(t){var e=_toPrimitive(t,"string");return _typeof(e)=="symbol"?e:e+""}function _toPrimitive(t,e){if(_typeof(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(_typeof(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ORIENT_MAP={xAxis:["bottom","top"],yAxis:["left","right"]},FULL_WIDTH_AND_HEIGHT={width:"100%",height:"100%"},originCoordinate={x:0,y:0};function renderAsIs(t){return t}var calculateTooltipPos=function(e,n){return n==="horizontal"?e.x:n==="vertical"?e.y:n==="centric"?e.angle:e.radius},getActiveCoordinate=function(e,n,o,l){var d=n.find(function(S){return S&&S.index===o});if(d){if(e==="horizontal")return{x:d.coordinate,y:l.y};if(e==="vertical")return{x:l.x,y:d.coordinate};if(e==="centric"){var f=d.coordinate,g=l.radius;return _objectSpread(_objectSpread(_objectSpread({},l),polarToCartesian(l.cx,l.cy,g,f)),{},{angle:f,radius:g})}var b=d.coordinate,_=l.angle;return _objectSpread(_objectSpread(_objectSpread({},l),polarToCartesian(l.cx,l.cy,b,_)),{},{angle:_,radius:b})}return originCoordinate},getDisplayedData=function(e,n){var o=n.graphicalItems,l=n.dataStartIndex,d=n.dataEndIndex,f=(o??[]).reduce(function(g,b){var _=b.props.data;return _&&_.length?[].concat(_toConsumableArray(g),_toConsumableArray(_)):g},[]);return f.length>0?f:e&&e.length&&isNumber$2(l)&&isNumber$2(d)?e.slice(l,d+1):[]};function getDefaultDomainByAxisType(t){return t==="number"?[0,"auto"]:void 0}var getTooltipContent=function(e,n,o,l){var d=e.graphicalItems,f=e.tooltipAxis,g=getDisplayedData(n,e);return o<0||!d||!d.length||o>=g.length?null:d.reduce(function(b,_){var S,R=(S=_.props.data)!==null&&S!==void 0?S:n;R&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=o&&(R=R.slice(e.dataStartIndex,e.dataEndIndex+1));var C;if(f.dataKey&&!f.allowDuplicatedCategory){var E=R===void 0?g:R;C=findEntryInArray(E,f.dataKey,l)}else C=R&&R[o]||g[o];return C?[].concat(_toConsumableArray(b),[getTooltipItem(_,C)]):b},[])},getTooltipData=function(e,n,o,l){var d=l||{x:e.chartX,y:e.chartY},f=calculateTooltipPos(d,o),g=e.orderedTooltipTicks,b=e.tooltipAxis,_=e.tooltipTicks,S=calculateActiveTickIndex(f,g,_,b);if(S>=0&&_){var R=_[S]&&_[S].value,C=getTooltipContent(e,n,S,R),E=getActiveCoordinate(o,g,S,d);return{activeTooltipIndex:S,activeLabel:R,activePayload:C,activeCoordinate:E}}return null},getAxisMapByAxes=function(e,n){var o=n.axes,l=n.graphicalItems,d=n.axisType,f=n.axisIdKey,g=n.stackGroups,b=n.dataStartIndex,_=n.dataEndIndex,S=e.layout,R=e.children,C=e.stackOffset,E=isCategoricalAxis(S,d);return o.reduce(function(A,M){var I,j=M.type.defaultProps!==void 0?_objectSpread(_objectSpread({},M.type.defaultProps),M.props):M.props,q=j.type,z=j.dataKey,Q=j.allowDataOverflow,F=j.allowDuplicatedCategory,V=j.scale,te=j.ticks,ne=j.includeHidden,se=j[f];if(A[se])return A;var ge=getDisplayedData(e.data,{graphicalItems:l.filter(function(He){var Ze,tt=f in He.props?He.props[f]:(Ze=He.type.defaultProps)===null||Ze===void 0?void 0:Ze[f];return tt===se}),dataStartIndex:b,dataEndIndex:_}),oe=ge.length,Ae,je,Ne;isDomainSpecifiedByUser(j.domain,Q,q)&&(Ae=parseSpecifiedDomain(j.domain,null,Q),E&&(q==="number"||V!=="auto")&&(Ne=getDomainOfDataByKey(ge,z,"category")));var Oe=getDefaultDomainByAxisType(q);if(!Ae||Ae.length===0){var Fe,ze=(Fe=j.domain)!==null&&Fe!==void 0?Fe:Oe;if(z){if(Ae=getDomainOfDataByKey(ge,z,q),q==="category"&&E){var $e=hasDuplicate(Ae);F&&$e?(je=Ae,Ae=range(0,oe)):F||(Ae=parseDomainOfCategoryAxis(ze,Ae,M).reduce(function(He,Ze){return He.indexOf(Ze)>=0?He:[].concat(_toConsumableArray(He),[Ze])},[]))}else if(q==="category")F?Ae=Ae.filter(function(He){return He!==""&&!isNil(He)}):Ae=parseDomainOfCategoryAxis(ze,Ae,M).reduce(function(He,Ze){return He.indexOf(Ze)>=0||Ze===""||isNil(Ze)?He:[].concat(_toConsumableArray(He),[Ze])},[]);else if(q==="number"){var Be=parseErrorBarsOfAxis(ge,l.filter(function(He){var Ze,tt,Ye=f in He.props?He.props[f]:(Ze=He.type.defaultProps)===null||Ze===void 0?void 0:Ze[f],Qe="hide"in He.props?He.props.hide:(tt=He.type.defaultProps)===null||tt===void 0?void 0:tt.hide;return Ye===se&&(ne||!Qe)}),z,d,S);Be&&(Ae=Be)}E&&(q==="number"||V!=="auto")&&(Ne=getDomainOfDataByKey(ge,z,"category"))}else E?Ae=range(0,oe):g&&g[se]&&g[se].hasStack&&q==="number"?Ae=C==="expand"?[0,1]:getDomainOfStackGroups(g[se].stackGroups,b,_):Ae=getDomainOfItemsWithSameAxis(ge,l.filter(function(He){var Ze=f in He.props?He.props[f]:He.type.defaultProps[f],tt="hide"in He.props?He.props.hide:He.type.defaultProps.hide;return Ze===se&&(ne||!tt)}),q,S,!0);if(q==="number")Ae=detectReferenceElementsDomain(R,Ae,se,d,te),ze&&(Ae=parseSpecifiedDomain(ze,Ae,Q));else if(q==="category"&&ze){var qe=ze,Ge=Ae.every(function(He){return qe.indexOf(He)>=0});Ge&&(Ae=qe)}}return _objectSpread(_objectSpread({},A),{},_defineProperty({},se,_objectSpread(_objectSpread({},j),{},{axisType:d,domain:Ae,categoricalDomain:Ne,duplicateDomain:je,originalDomain:(I=j.domain)!==null&&I!==void 0?I:Oe,isCategorical:E,layout:S})))},{})},getAxisMapByItems=function(e,n){var o=n.graphicalItems,l=n.Axis,d=n.axisType,f=n.axisIdKey,g=n.stackGroups,b=n.dataStartIndex,_=n.dataEndIndex,S=e.layout,R=e.children,C=getDisplayedData(e.data,{graphicalItems:o,dataStartIndex:b,dataEndIndex:_}),E=C.length,A=isCategoricalAxis(S,d),M=-1;return o.reduce(function(I,j){var q=j.type.defaultProps!==void 0?_objectSpread(_objectSpread({},j.type.defaultProps),j.props):j.props,z=q[f],Q=getDefaultDomainByAxisType("number");if(!I[z]){M++;var F;return A?F=range(0,E):g&&g[z]&&g[z].hasStack?(F=getDomainOfStackGroups(g[z].stackGroups,b,_),F=detectReferenceElementsDomain(R,F,z,d)):(F=parseSpecifiedDomain(Q,getDomainOfItemsWithSameAxis(C,o.filter(function(V){var te,ne,se=f in V.props?V.props[f]:(te=V.type.defaultProps)===null||te===void 0?void 0:te[f],ge="hide"in V.props?V.props.hide:(ne=V.type.defaultProps)===null||ne===void 0?void 0:ne.hide;return se===z&&!ge}),"number",S),l.defaultProps.allowDataOverflow),F=detectReferenceElementsDomain(R,F,z,d)),_objectSpread(_objectSpread({},I),{},_defineProperty({},z,_objectSpread(_objectSpread({axisType:d},l.defaultProps),{},{hide:!0,orientation:get$1(ORIENT_MAP,"".concat(d,".").concat(M%2),null),domain:F,originalDomain:Q,isCategorical:A,layout:S})))}return I},{})},getAxisMap=function(e,n){var o=n.axisType,l=o===void 0?"xAxis":o,d=n.AxisComp,f=n.graphicalItems,g=n.stackGroups,b=n.dataStartIndex,_=n.dataEndIndex,S=e.children,R="".concat(l,"Id"),C=findAllByType(S,d),E={};return C&&C.length?E=getAxisMapByAxes(e,{axes:C,graphicalItems:f,axisType:l,axisIdKey:R,stackGroups:g,dataStartIndex:b,dataEndIndex:_}):f&&f.length&&(E=getAxisMapByItems(e,{Axis:d,graphicalItems:f,axisType:l,axisIdKey:R,stackGroups:g,dataStartIndex:b,dataEndIndex:_})),E},tooltipTicksGenerator=function(e){var n=getAnyElementOfObject(e),o=getTicksOfAxis(n,!1,!0);return{tooltipTicks:o,orderedTooltipTicks:sortBy(o,function(l){return l.coordinate}),tooltipAxis:n,tooltipAxisBandSize:getBandSizeOfAxis(n,o)}},createDefaultState=function(e){var n=e.children,o=e.defaultShowTooltip,l=findChildByType(n,Brush),d=0,f=0;return e.data&&e.data.length!==0&&(f=e.data.length-1),l&&l.props&&(l.props.startIndex>=0&&(d=l.props.startIndex),l.props.endIndex>=0&&(f=l.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:d,dataEndIndex:f,activeTooltipIndex:-1,isTooltipActive:!!o}},hasGraphicalBarItem=function(e){return!e||!e.length?!1:e.some(function(n){var o=getDisplayName(n&&n.type);return o&&o.indexOf("Bar")>=0})},getAxisNameByLayout=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},calculateOffset=function(e,n){var o=e.props,l=e.graphicalItems,d=e.xAxisMap,f=d===void 0?{}:d,g=e.yAxisMap,b=g===void 0?{}:g,_=o.width,S=o.height,R=o.children,C=o.margin||{},E=findChildByType(R,Brush),A=findChildByType(R,Legend),M=Object.keys(b).reduce(function(F,V){var te=b[V],ne=te.orientation;return!te.mirror&&!te.hide?_objectSpread(_objectSpread({},F),{},_defineProperty({},ne,F[ne]+te.width)):F},{left:C.left||0,right:C.right||0}),I=Object.keys(f).reduce(function(F,V){var te=f[V],ne=te.orientation;return!te.mirror&&!te.hide?_objectSpread(_objectSpread({},F),{},_defineProperty({},ne,get$1(F,"".concat(ne))+te.height)):F},{top:C.top||0,bottom:C.bottom||0}),j=_objectSpread(_objectSpread({},I),M),q=j.bottom;E&&(j.bottom+=E.props.height||Brush.defaultProps.height),A&&n&&(j=appendOffsetOfLegend(j,l,o,n));var z=_-j.left-j.right,Q=S-j.top-j.bottom;return _objectSpread(_objectSpread({brushBottom:q},j),{},{width:Math.max(z,0),height:Math.max(Q,0)})},getCartesianAxisSize=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},generateCategoricalChart=function(e){var n=e.chartName,o=e.GraphicalChild,l=e.defaultTooltipEventType,d=l===void 0?"axis":l,f=e.validateTooltipEventTypes,g=f===void 0?["axis"]:f,b=e.axisComponents,_=e.legendContent,S=e.formatAxisMap,R=e.defaultProps,C=function(j,q){var z=q.graphicalItems,Q=q.stackGroups,F=q.offset,V=q.updateId,te=q.dataStartIndex,ne=q.dataEndIndex,se=j.barSize,ge=j.layout,oe=j.barGap,Ae=j.barCategoryGap,je=j.maxBarSize,Ne=getAxisNameByLayout(ge),Oe=Ne.numericAxisName,Fe=Ne.cateAxisName,ze=hasGraphicalBarItem(z),$e=[];return z.forEach(function(Be,qe){var Ge=getDisplayedData(j.data,{graphicalItems:[Be],dataStartIndex:te,dataEndIndex:ne}),He=Be.type.defaultProps!==void 0?_objectSpread(_objectSpread({},Be.type.defaultProps),Be.props):Be.props,Ze=He.dataKey,tt=He.maxBarSize,Ye=He["".concat(Oe,"Id")],Qe=He["".concat(Fe,"Id")],Xe={},st=b.reduce(function(it,et){var ct,ft,dt=q["".concat(et.axisType,"Map")],Rt=He["".concat(et.axisType,"Id")];dt&&dt[Rt]||et.axisType==="zAxis"||(process.env.NODE_ENV!=="production"?invariant$1(!1,"Specifying a(n) ".concat(et.axisType,"Id requires a corresponding ").concat(et.axisType,"Id on the targeted graphical component ").concat((ct=Be==null||(ft=Be.type)===null||ft===void 0?void 0:ft.displayName)!==null&&ct!==void 0?ct:"")):invariant$1());var zt=dt[Rt];return _objectSpread(_objectSpread({},it),{},_defineProperty(_defineProperty({},et.axisType,zt),"".concat(et.axisType,"Ticks"),getTicksOfAxis(zt)))},Xe),rt=st[Fe],at=st["".concat(Fe,"Ticks")],ot=Q&&Q[Ye]&&Q[Ye].hasStack&&getStackedDataOfItem(Be,Q[Ye].stackGroups),Ue=getDisplayName(Be.type).indexOf("Bar")>=0,Ct=getBandSizeOfAxis(rt,at),Je=[],yt=ze&&getBarSizeList({barSize:se,stackGroups:Q,totalSize:getCartesianAxisSize(st,Fe)});if(Ue){var Mt,qt,Ht=isNil(tt)?je:tt,Ft=(Mt=(qt=getBandSizeOfAxis(rt,at,!0))!==null&&qt!==void 0?qt:Ht)!==null&&Mt!==void 0?Mt:0;Je=getBarPosition({barGap:oe,barCategoryGap:Ae,bandSize:Ft!==Ct?Ft:Ct,sizeList:yt[Qe],maxBarSize:Ht}),Ft!==Ct&&(Je=Je.map(function(it){return _objectSpread(_objectSpread({},it),{},{position:_objectSpread(_objectSpread({},it.position),{},{offset:it.position.offset-Ft/2})})}))}var Ke=Be&&Be.type&&Be.type.getComposedData;Ke&&$e.push({props:_objectSpread(_objectSpread({},Ke(_objectSpread(_objectSpread({},st),{},{displayedData:Ge,props:j,dataKey:Ze,item:Be,bandSize:Ct,barPosition:Je,offset:F,stackedData:ot,layout:ge,dataStartIndex:te,dataEndIndex:ne}))),{},_defineProperty(_defineProperty(_defineProperty({key:Be.key||"item-".concat(qe)},Oe,st[Oe]),Fe,st[Fe]),"animationId",V)),childIndex:parseChildIndex(Be,j.children),item:Be})}),$e},E=function(j,q){var z=j.props,Q=j.dataStartIndex,F=j.dataEndIndex,V=j.updateId;if(!validateWidthHeight({props:z}))return null;var te=z.children,ne=z.layout,se=z.stackOffset,ge=z.data,oe=z.reverseStackOrder,Ae=getAxisNameByLayout(ne),je=Ae.numericAxisName,Ne=Ae.cateAxisName,Oe=findAllByType(te,o),Fe=getStackGroupsByAxisId(ge,Oe,"".concat(je,"Id"),"".concat(Ne,"Id"),se,oe),ze=b.reduce(function(He,Ze){var tt="".concat(Ze.axisType,"Map");return _objectSpread(_objectSpread({},He),{},_defineProperty({},tt,getAxisMap(z,_objectSpread(_objectSpread({},Ze),{},{graphicalItems:Oe,stackGroups:Ze.axisType===je&&Fe,dataStartIndex:Q,dataEndIndex:F}))))},{}),$e=calculateOffset(_objectSpread(_objectSpread({},ze),{},{props:z,graphicalItems:Oe}),q==null?void 0:q.legendBBox);Object.keys(ze).forEach(function(He){ze[He]=S(z,ze[He],$e,He.replace("Map",""),n)});var Be=ze["".concat(Ne,"Map")],qe=tooltipTicksGenerator(Be),Ge=C(z,_objectSpread(_objectSpread({},ze),{},{dataStartIndex:Q,dataEndIndex:F,updateId:V,graphicalItems:Oe,stackGroups:Fe,offset:$e}));return _objectSpread(_objectSpread({formattedGraphicalItems:Ge,graphicalItems:Oe,offset:$e,stackGroups:Fe},qe),ze)},A=function(I){function j(q){var z,Q,F;return _classCallCheck(this,j),F=_callSuper(this,j,[q]),_defineProperty(F,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),_defineProperty(F,"accessibilityManager",new AccessibilityManager),_defineProperty(F,"handleLegendBBoxUpdate",function(V){if(V){var te=F.state,ne=te.dataStartIndex,se=te.dataEndIndex,ge=te.updateId;F.setState(_objectSpread({legendBBox:V},E({props:F.props,dataStartIndex:ne,dataEndIndex:se,updateId:ge},_objectSpread(_objectSpread({},F.state),{},{legendBBox:V}))))}}),_defineProperty(F,"handleReceiveSyncEvent",function(V,te,ne){if(F.props.syncId===V){if(ne===F.eventEmitterSymbol&&typeof F.props.syncMethod!="function")return;F.applySyncEvent(te)}}),_defineProperty(F,"handleBrushChange",function(V){var te=V.startIndex,ne=V.endIndex;if(te!==F.state.dataStartIndex||ne!==F.state.dataEndIndex){var se=F.state.updateId;F.setState(function(){return _objectSpread({dataStartIndex:te,dataEndIndex:ne},E({props:F.props,dataStartIndex:te,dataEndIndex:ne,updateId:se},F.state))}),F.triggerSyncEvent({dataStartIndex:te,dataEndIndex:ne})}}),_defineProperty(F,"handleMouseEnter",function(V){var te=F.getMouseInfo(V);if(te){var ne=_objectSpread(_objectSpread({},te),{},{isTooltipActive:!0});F.setState(ne),F.triggerSyncEvent(ne);var se=F.props.onMouseEnter;isFunction$4(se)&&se(ne,V)}}),_defineProperty(F,"triggeredAfterMouseMove",function(V){var te=F.getMouseInfo(V),ne=te?_objectSpread(_objectSpread({},te),{},{isTooltipActive:!0}):{isTooltipActive:!1};F.setState(ne),F.triggerSyncEvent(ne);var se=F.props.onMouseMove;isFunction$4(se)&&se(ne,V)}),_defineProperty(F,"handleItemMouseEnter",function(V){F.setState(function(){return{isTooltipActive:!0,activeItem:V,activePayload:V.tooltipPayload,activeCoordinate:V.tooltipPosition||{x:V.cx,y:V.cy}}})}),_defineProperty(F,"handleItemMouseLeave",function(){F.setState(function(){return{isTooltipActive:!1}})}),_defineProperty(F,"handleMouseMove",function(V){V.persist(),F.throttleTriggeredAfterMouseMove(V)}),_defineProperty(F,"handleMouseLeave",function(V){F.throttleTriggeredAfterMouseMove.cancel();var te={isTooltipActive:!1};F.setState(te),F.triggerSyncEvent(te);var ne=F.props.onMouseLeave;isFunction$4(ne)&&ne(te,V)}),_defineProperty(F,"handleOuterEvent",function(V){var te=getReactEventByType(V),ne=get$1(F.props,"".concat(te));if(te&&isFunction$4(ne)){var se,ge;/.*touch.*/i.test(te)?ge=F.getMouseInfo(V.changedTouches[0]):ge=F.getMouseInfo(V),ne((se=ge)!==null&&se!==void 0?se:{},V)}}),_defineProperty(F,"handleClick",function(V){var te=F.getMouseInfo(V);if(te){var ne=_objectSpread(_objectSpread({},te),{},{isTooltipActive:!0});F.setState(ne),F.triggerSyncEvent(ne);var se=F.props.onClick;isFunction$4(se)&&se(ne,V)}}),_defineProperty(F,"handleMouseDown",function(V){var te=F.props.onMouseDown;if(isFunction$4(te)){var ne=F.getMouseInfo(V);te(ne,V)}}),_defineProperty(F,"handleMouseUp",function(V){var te=F.props.onMouseUp;if(isFunction$4(te)){var ne=F.getMouseInfo(V);te(ne,V)}}),_defineProperty(F,"handleTouchMove",function(V){V.changedTouches!=null&&V.changedTouches.length>0&&F.throttleTriggeredAfterMouseMove(V.changedTouches[0])}),_defineProperty(F,"handleTouchStart",function(V){V.changedTouches!=null&&V.changedTouches.length>0&&F.handleMouseDown(V.changedTouches[0])}),_defineProperty(F,"handleTouchEnd",function(V){V.changedTouches!=null&&V.changedTouches.length>0&&F.handleMouseUp(V.changedTouches[0])}),_defineProperty(F,"handleDoubleClick",function(V){var te=F.props.onDoubleClick;if(isFunction$4(te)){var ne=F.getMouseInfo(V);te(ne,V)}}),_defineProperty(F,"handleContextMenu",function(V){var te=F.props.onContextMenu;if(isFunction$4(te)){var ne=F.getMouseInfo(V);te(ne,V)}}),_defineProperty(F,"triggerSyncEvent",function(V){F.props.syncId!==void 0&&eventCenter.emit(SYNC_EVENT,F.props.syncId,V,F.eventEmitterSymbol)}),_defineProperty(F,"applySyncEvent",function(V){var te=F.props,ne=te.layout,se=te.syncMethod,ge=F.state.updateId,oe=V.dataStartIndex,Ae=V.dataEndIndex;if(V.dataStartIndex!==void 0||V.dataEndIndex!==void 0)F.setState(_objectSpread({dataStartIndex:oe,dataEndIndex:Ae},E({props:F.props,dataStartIndex:oe,dataEndIndex:Ae,updateId:ge},F.state)));else if(V.activeTooltipIndex!==void 0){var je=V.chartX,Ne=V.chartY,Oe=V.activeTooltipIndex,Fe=F.state,ze=Fe.offset,$e=Fe.tooltipTicks;if(!ze)return;if(typeof se=="function")Oe=se($e,V);else if(se==="value"){Oe=-1;for(var Be=0;Be<$e.length;Be++)if($e[Be].value===V.activeLabel){Oe=Be;break}}var qe=_objectSpread(_objectSpread({},ze),{},{x:ze.left,y:ze.top}),Ge=Math.min(je,qe.x+qe.width),He=Math.min(Ne,qe.y+qe.height),Ze=$e[Oe]&&$e[Oe].value,tt=getTooltipContent(F.state,F.props.data,Oe),Ye=$e[Oe]?{x:ne==="horizontal"?$e[Oe].coordinate:Ge,y:ne==="horizontal"?He:$e[Oe].coordinate}:originCoordinate;F.setState(_objectSpread(_objectSpread({},V),{},{activeLabel:Ze,activeCoordinate:Ye,activePayload:tt,activeTooltipIndex:Oe}))}else F.setState(V)}),_defineProperty(F,"renderCursor",function(V){var te,ne=F.state,se=ne.isTooltipActive,ge=ne.activeCoordinate,oe=ne.activePayload,Ae=ne.offset,je=ne.activeTooltipIndex,Ne=ne.tooltipAxisBandSize,Oe=F.getTooltipEventType(),Fe=(te=V.props.active)!==null&&te!==void 0?te:se,ze=F.props.layout,$e=V.key||"_recharts-cursor";return React.createElement(Cursor,{key:$e,activeCoordinate:ge,activePayload:oe,activeTooltipIndex:je,chartName:n,element:V,isActive:Fe,layout:ze,offset:Ae,tooltipAxisBandSize:Ne,tooltipEventType:Oe})}),_defineProperty(F,"renderPolarAxis",function(V,te,ne){var se=get$1(V,"type.axisType"),ge=get$1(F.state,"".concat(se,"Map")),oe=V.type.defaultProps,Ae=oe!==void 0?_objectSpread(_objectSpread({},oe),V.props):V.props,je=ge&&ge[Ae["".concat(se,"Id")]];return React.cloneElement(V,_objectSpread(_objectSpread({},je),{},{className:clsx(se,je.className),key:V.key||"".concat(te,"-").concat(ne),ticks:getTicksOfAxis(je,!0)}))}),_defineProperty(F,"renderPolarGrid",function(V){var te=V.props,ne=te.radialLines,se=te.polarAngles,ge=te.polarRadius,oe=F.state,Ae=oe.radiusAxisMap,je=oe.angleAxisMap,Ne=getAnyElementOfObject(Ae),Oe=getAnyElementOfObject(je),Fe=Oe.cx,ze=Oe.cy,$e=Oe.innerRadius,Be=Oe.outerRadius;return React.cloneElement(V,{polarAngles:Array.isArray(se)?se:getTicksOfAxis(Oe,!0).map(function(qe){return qe.coordinate}),polarRadius:Array.isArray(ge)?ge:getTicksOfAxis(Ne,!0).map(function(qe){return qe.coordinate}),cx:Fe,cy:ze,innerRadius:$e,outerRadius:Be,key:V.key||"polar-grid",radialLines:ne})}),_defineProperty(F,"renderLegend",function(){var V=F.state.formattedGraphicalItems,te=F.props,ne=te.children,se=te.width,ge=te.height,oe=F.props.margin||{},Ae=se-(oe.left||0)-(oe.right||0),je=getLegendProps({children:ne,formattedGraphicalItems:V,legendWidth:Ae,legendContent:_});if(!je)return null;var Ne=je.item,Oe=_objectWithoutProperties(je,_excluded);return React.cloneElement(Ne,_objectSpread(_objectSpread({},Oe),{},{chartWidth:se,chartHeight:ge,margin:oe,onBBoxUpdate:F.handleLegendBBoxUpdate}))}),_defineProperty(F,"renderTooltip",function(){var V,te=F.props,ne=te.children,se=te.accessibilityLayer,ge=findChildByType(ne,Tooltip);if(!ge)return null;var oe=F.state,Ae=oe.isTooltipActive,je=oe.activeCoordinate,Ne=oe.activePayload,Oe=oe.activeLabel,Fe=oe.offset,ze=(V=ge.props.active)!==null&&V!==void 0?V:Ae;return React.cloneElement(ge,{viewBox:_objectSpread(_objectSpread({},Fe),{},{x:Fe.left,y:Fe.top}),active:ze,label:Oe,payload:ze?Ne:[],coordinate:je,accessibilityLayer:se})}),_defineProperty(F,"renderBrush",function(V){var te=F.props,ne=te.margin,se=te.data,ge=F.state,oe=ge.offset,Ae=ge.dataStartIndex,je=ge.dataEndIndex,Ne=ge.updateId;return React.cloneElement(V,{key:V.key||"_recharts-brush",onChange:combineEventHandlers(F.handleBrushChange,V.props.onChange),data:se,x:isNumber$2(V.props.x)?V.props.x:oe.left,y:isNumber$2(V.props.y)?V.props.y:oe.top+oe.height+oe.brushBottom-(ne.bottom||0),width:isNumber$2(V.props.width)?V.props.width:oe.width,startIndex:Ae,endIndex:je,updateId:"brush-".concat(Ne)})}),_defineProperty(F,"renderReferenceElement",function(V,te,ne){if(!V)return null;var se=F,ge=se.clipPathId,oe=F.state,Ae=oe.xAxisMap,je=oe.yAxisMap,Ne=oe.offset,Oe=V.type.defaultProps||{},Fe=V.props,ze=Fe.xAxisId,$e=ze===void 0?Oe.xAxisId:ze,Be=Fe.yAxisId,qe=Be===void 0?Oe.yAxisId:Be;return React.cloneElement(V,{key:V.key||"".concat(te,"-").concat(ne),xAxis:Ae[$e],yAxis:je[qe],viewBox:{x:Ne.left,y:Ne.top,width:Ne.width,height:Ne.height},clipPathId:ge})}),_defineProperty(F,"renderActivePoints",function(V){var te=V.item,ne=V.activePoint,se=V.basePoint,ge=V.childIndex,oe=V.isRange,Ae=[],je=te.props.key,Ne=te.item.type.defaultProps!==void 0?_objectSpread(_objectSpread({},te.item.type.defaultProps),te.item.props):te.item.props,Oe=Ne.activeDot,Fe=Ne.dataKey,ze=_objectSpread(_objectSpread({index:ge,dataKey:Fe,cx:ne.x,cy:ne.y,r:4,fill:getMainColorOfGraphicItem(te.item),strokeWidth:2,stroke:"#fff",payload:ne.payload,value:ne.value},filterProps(Oe,!1)),adaptEventHandlers(Oe));return Ae.push(j.renderActiveDot(Oe,ze,"".concat(je,"-activePoint-").concat(ge))),se?Ae.push(j.renderActiveDot(Oe,_objectSpread(_objectSpread({},ze),{},{cx:se.x,cy:se.y}),"".concat(je,"-basePoint-").concat(ge))):oe&&Ae.push(null),Ae}),_defineProperty(F,"renderGraphicChild",function(V,te,ne){var se=F.filterFormatItem(V,te,ne);if(!se)return null;var ge=F.getTooltipEventType(),oe=F.state,Ae=oe.isTooltipActive,je=oe.tooltipAxis,Ne=oe.activeTooltipIndex,Oe=oe.activeLabel,Fe=F.props.children,ze=findChildByType(Fe,Tooltip),$e=se.props,Be=$e.points,qe=$e.isRange,Ge=$e.baseLine,He=se.item.type.defaultProps!==void 0?_objectSpread(_objectSpread({},se.item.type.defaultProps),se.item.props):se.item.props,Ze=He.activeDot,tt=He.hide,Ye=He.activeBar,Qe=He.activeShape,Xe=!!(!tt&&Ae&&ze&&(Ze||Ye||Qe)),st={};ge!=="axis"&&ze&&ze.props.trigger==="click"?st={onClick:combineEventHandlers(F.handleItemMouseEnter,V.props.onClick)}:ge!=="axis"&&(st={onMouseLeave:combineEventHandlers(F.handleItemMouseLeave,V.props.onMouseLeave),onMouseEnter:combineEventHandlers(F.handleItemMouseEnter,V.props.onMouseEnter)});var rt=React.cloneElement(V,_objectSpread(_objectSpread({},se.props),st));function at(et){return typeof je.dataKey=="function"?je.dataKey(et.payload):null}if(Xe)if(Ne>=0){var ot,Ue;if(je.dataKey&&!je.allowDuplicatedCategory){var Ct=typeof je.dataKey=="function"?at:"payload.".concat(je.dataKey.toString());ot=findEntryInArray(Be,Ct,Oe),Ue=qe&&Ge&&findEntryInArray(Ge,Ct,Oe)}else ot=Be==null?void 0:Be[Ne],Ue=qe&&Ge&&Ge[Ne];if(Qe||Ye){var Je=V.props.activeIndex!==void 0?V.props.activeIndex:Ne;return[React.cloneElement(V,_objectSpread(_objectSpread(_objectSpread({},se.props),st),{},{activeIndex:Je})),null,null]}if(!isNil(ot))return[rt].concat(_toConsumableArray(F.renderActivePoints({item:se,activePoint:ot,basePoint:Ue,childIndex:Ne,isRange:qe})))}else{var yt,Mt=(yt=F.getItemByXY(F.state.activeCoordinate))!==null&&yt!==void 0?yt:{graphicalItem:rt},qt=Mt.graphicalItem,Ht=qt.item,Ft=Ht===void 0?V:Ht,Ke=qt.childIndex,it=_objectSpread(_objectSpread(_objectSpread({},se.props),st),{},{activeIndex:Ke});return[React.cloneElement(Ft,it),null,null]}return qe?[rt,null,null]:[rt,null]}),_defineProperty(F,"renderCustomized",function(V,te,ne){return React.cloneElement(V,_objectSpread(_objectSpread({key:"recharts-customized-".concat(ne)},F.props),F.state))}),_defineProperty(F,"renderMap",{CartesianGrid:{handler:renderAsIs,once:!0},ReferenceArea:{handler:F.renderReferenceElement},ReferenceLine:{handler:renderAsIs},ReferenceDot:{handler:F.renderReferenceElement},XAxis:{handler:renderAsIs},YAxis:{handler:renderAsIs},Brush:{handler:F.renderBrush,once:!0},Bar:{handler:F.renderGraphicChild},Line:{handler:F.renderGraphicChild},Area:{handler:F.renderGraphicChild},Radar:{handler:F.renderGraphicChild},RadialBar:{handler:F.renderGraphicChild},Scatter:{handler:F.renderGraphicChild},Pie:{handler:F.renderGraphicChild},Funnel:{handler:F.renderGraphicChild},Tooltip:{handler:F.renderCursor,once:!0},PolarGrid:{handler:F.renderPolarGrid,once:!0},PolarAngleAxis:{handler:F.renderPolarAxis},PolarRadiusAxis:{handler:F.renderPolarAxis},Customized:{handler:F.renderCustomized}}),F.clipPathId="".concat((z=q.id)!==null&&z!==void 0?z:uniqueId("recharts"),"-clip"),F.throttleTriggeredAfterMouseMove=throttle(F.triggeredAfterMouseMove,(Q=q.throttleDelay)!==null&&Q!==void 0?Q:1e3/60),F.state={},F}return _inherits(j,I),_createClass(j,[{key:"componentDidMount",value:function(){var z,Q;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(z=this.props.margin.left)!==null&&z!==void 0?z:0,top:(Q=this.props.margin.top)!==null&&Q!==void 0?Q:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var z=this.props,Q=z.children,F=z.data,V=z.height,te=z.layout,ne=findChildByType(Q,Tooltip);if(ne){var se=ne.props.defaultIndex;if(!(typeof se!="number"||se<0||se>this.state.tooltipTicks.length-1)){var ge=this.state.tooltipTicks[se]&&this.state.tooltipTicks[se].value,oe=getTooltipContent(this.state,F,se,ge),Ae=this.state.tooltipTicks[se].coordinate,je=(this.state.offset.top+V)/2,Ne=te==="horizontal",Oe=Ne?{x:Ae,y:je}:{y:Ae,x:je},Fe=this.state.formattedGraphicalItems.find(function($e){var Be=$e.item;return Be.type.name==="Scatter"});Fe&&(Oe=_objectSpread(_objectSpread({},Oe),Fe.props.points[se].tooltipPosition),oe=Fe.props.points[se].tooltipPayload);var ze={activeTooltipIndex:se,isTooltipActive:!0,activeLabel:ge,activePayload:oe,activeCoordinate:Oe};this.setState(ze),this.renderCursor(ne),this.accessibilityManager.setIndex(se)}}}},{key:"getSnapshotBeforeUpdate",value:function(z,Q){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==Q.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==z.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==z.margin){var F,V;this.accessibilityManager.setDetails({offset:{left:(F=this.props.margin.left)!==null&&F!==void 0?F:0,top:(V=this.props.margin.top)!==null&&V!==void 0?V:0}})}return null}},{key:"componentDidUpdate",value:function(z){isChildrenEqual([findChildByType(z.children,Tooltip)],[findChildByType(this.props.children,Tooltip)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var z=findChildByType(this.props.children,Tooltip);if(z&&typeof z.props.shared=="boolean"){var Q=z.props.shared?"axis":"item";return g.indexOf(Q)>=0?Q:d}return d}},{key:"getMouseInfo",value:function(z){if(!this.container)return null;var Q=this.container,F=Q.getBoundingClientRect(),V=getOffset(F),te={chartX:Math.round(z.pageX-V.left),chartY:Math.round(z.pageY-V.top)},ne=F.width/Q.offsetWidth||1,se=this.inRange(te.chartX,te.chartY,ne);if(!se)return null;var ge=this.state,oe=ge.xAxisMap,Ae=ge.yAxisMap,je=this.getTooltipEventType(),Ne=getTooltipData(this.state,this.props.data,this.props.layout,se);if(je!=="axis"&&oe&&Ae){var Oe=getAnyElementOfObject(oe).scale,Fe=getAnyElementOfObject(Ae).scale,ze=Oe&&Oe.invert?Oe.invert(te.chartX):null,$e=Fe&&Fe.invert?Fe.invert(te.chartY):null;return _objectSpread(_objectSpread({},te),{},{xValue:ze,yValue:$e},Ne)}return Ne?_objectSpread(_objectSpread({},te),Ne):null}},{key:"inRange",value:function(z,Q){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=this.props.layout,te=z/F,ne=Q/F;if(V==="horizontal"||V==="vertical"){var se=this.state.offset,ge=te>=se.left&&te<=se.left+se.width&&ne>=se.top&&ne<=se.top+se.height;return ge?{x:te,y:ne}:null}var oe=this.state,Ae=oe.angleAxisMap,je=oe.radiusAxisMap;if(Ae&&je){var Ne=getAnyElementOfObject(Ae);return inRangeOfSector({x:te,y:ne},Ne)}return null}},{key:"parseEventsOfWrapper",value:function(){var z=this.props.children,Q=this.getTooltipEventType(),F=findChildByType(z,Tooltip),V={};F&&Q==="axis"&&(F.props.trigger==="click"?V={onClick:this.handleClick}:V={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var te=adaptEventHandlers(this.props,this.handleOuterEvent);return _objectSpread(_objectSpread({},te),V)}},{key:"addListener",value:function(){eventCenter.on(SYNC_EVENT,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){eventCenter.removeListener(SYNC_EVENT,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(z,Q,F){for(var V=this.state.formattedGraphicalItems,te=0,ne=V.length;te<ne;te++){var se=V[te];if(se.item===z||se.props.key===z.key||Q===getDisplayName(se.item.type)&&F===se.childIndex)return se}return null}},{key:"renderClipPath",value:function(){var z=this.clipPathId,Q=this.state.offset,F=Q.left,V=Q.top,te=Q.height,ne=Q.width;return React.createElement("defs",null,React.createElement("clipPath",{id:z},React.createElement("rect",{x:F,y:V,height:te,width:ne})))}},{key:"getXScales",value:function(){var z=this.state.xAxisMap;return z?Object.entries(z).reduce(function(Q,F){var V=_slicedToArray(F,2),te=V[0],ne=V[1];return _objectSpread(_objectSpread({},Q),{},_defineProperty({},te,ne.scale))},{}):null}},{key:"getYScales",value:function(){var z=this.state.yAxisMap;return z?Object.entries(z).reduce(function(Q,F){var V=_slicedToArray(F,2),te=V[0],ne=V[1];return _objectSpread(_objectSpread({},Q),{},_defineProperty({},te,ne.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(z){var Q;return(Q=this.state.xAxisMap)===null||Q===void 0||(Q=Q[z])===null||Q===void 0?void 0:Q.scale}},{key:"getYScaleByAxisId",value:function(z){var Q;return(Q=this.state.yAxisMap)===null||Q===void 0||(Q=Q[z])===null||Q===void 0?void 0:Q.scale}},{key:"getItemByXY",value:function(z){var Q=this.state,F=Q.formattedGraphicalItems,V=Q.activeItem;if(F&&F.length)for(var te=0,ne=F.length;te<ne;te++){var se=F[te],ge=se.props,oe=se.item,Ae=oe.type.defaultProps!==void 0?_objectSpread(_objectSpread({},oe.type.defaultProps),oe.props):oe.props,je=getDisplayName(oe.type);if(je==="Bar"){var Ne=(ge.data||[]).find(function($e){return isInRectangle(z,$e)});if(Ne)return{graphicalItem:se,payload:Ne}}else if(je==="RadialBar"){var Oe=(ge.data||[]).find(function($e){return inRangeOfSector(z,$e)});if(Oe)return{graphicalItem:se,payload:Oe}}else if(isFunnel(se,V)||isPie(se,V)||isScatter(se,V)){var Fe=getActiveShapeIndexForTooltip({graphicalItem:se,activeTooltipItem:V,itemData:Ae.data}),ze=Ae.activeIndex===void 0?Fe:Ae.activeIndex;return{graphicalItem:_objectSpread(_objectSpread({},se),{},{childIndex:ze}),payload:isScatter(se,V)?Ae.data[Fe]:se.props.data[Fe]}}}return null}},{key:"render",value:function(){var z=this;if(!validateWidthHeight(this))return null;var Q=this.props,F=Q.children,V=Q.className,te=Q.width,ne=Q.height,se=Q.style,ge=Q.compact,oe=Q.title,Ae=Q.desc,je=_objectWithoutProperties(Q,_excluded2),Ne=filterProps(je,!1);if(ge)return React.createElement(ChartLayoutContextProvider,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},React.createElement(Surface,_extends({},Ne,{width:te,height:ne,title:oe,desc:Ae}),this.renderClipPath(),renderByOrder(F,this.renderMap)));if(this.props.accessibilityLayer){var Oe,Fe;Ne.tabIndex=(Oe=this.props.tabIndex)!==null&&Oe!==void 0?Oe:0,Ne.role=(Fe=this.props.role)!==null&&Fe!==void 0?Fe:"application",Ne.onKeyDown=function($e){z.accessibilityManager.keyboardEvent($e)},Ne.onFocus=function(){z.accessibilityManager.focus()}}var ze=this.parseEventsOfWrapper();return React.createElement(ChartLayoutContextProvider,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},React.createElement("div",_extends({className:clsx("recharts-wrapper",V),style:_objectSpread({position:"relative",cursor:"default",width:te,height:ne},se)},ze,{ref:function(Be){z.container=Be}}),React.createElement(Surface,_extends({},Ne,{width:te,height:ne,title:oe,desc:Ae,style:FULL_WIDTH_AND_HEIGHT}),this.renderClipPath(),renderByOrder(F,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(React.Component);_defineProperty(A,"displayName",n),_defineProperty(A,"defaultProps",_objectSpread({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},R)),_defineProperty(A,"getDerivedStateFromProps",function(I,j){var q=I.dataKey,z=I.data,Q=I.children,F=I.width,V=I.height,te=I.layout,ne=I.stackOffset,se=I.margin,ge=j.dataStartIndex,oe=j.dataEndIndex;if(j.updateId===void 0){var Ae=createDefaultState(I);return _objectSpread(_objectSpread(_objectSpread({},Ae),{},{updateId:0},E(_objectSpread(_objectSpread({props:I},Ae),{},{updateId:0}),j)),{},{prevDataKey:q,prevData:z,prevWidth:F,prevHeight:V,prevLayout:te,prevStackOffset:ne,prevMargin:se,prevChildren:Q})}if(q!==j.prevDataKey||z!==j.prevData||F!==j.prevWidth||V!==j.prevHeight||te!==j.prevLayout||ne!==j.prevStackOffset||!shallowEqual(se,j.prevMargin)){var je=createDefaultState(I),Ne={chartX:j.chartX,chartY:j.chartY,isTooltipActive:j.isTooltipActive},Oe=_objectSpread(_objectSpread({},getTooltipData(j,z,te)),{},{updateId:j.updateId+1}),Fe=_objectSpread(_objectSpread(_objectSpread({},je),Ne),Oe);return _objectSpread(_objectSpread(_objectSpread({},Fe),E(_objectSpread({props:I},Fe),j)),{},{prevDataKey:q,prevData:z,prevWidth:F,prevHeight:V,prevLayout:te,prevStackOffset:ne,prevMargin:se,prevChildren:Q})}if(!isChildrenEqual(Q,j.prevChildren)){var ze,$e,Be,qe,Ge=findChildByType(Q,Brush),He=Ge&&(ze=($e=Ge.props)===null||$e===void 0?void 0:$e.startIndex)!==null&&ze!==void 0?ze:ge,Ze=Ge&&(Be=(qe=Ge.props)===null||qe===void 0?void 0:qe.endIndex)!==null&&Be!==void 0?Be:oe,tt=He!==ge||Ze!==oe,Ye=!isNil(z),Qe=Ye&&!tt?j.updateId:j.updateId+1;return _objectSpread(_objectSpread({updateId:Qe},E(_objectSpread(_objectSpread({props:I},j),{},{updateId:Qe,dataStartIndex:He,dataEndIndex:Ze}),j)),{},{prevChildren:Q,dataStartIndex:He,dataEndIndex:Ze})}return null}),_defineProperty(A,"renderActiveDot",function(I,j,q){var z;return React.isValidElement(I)?z=React.cloneElement(I,j):isFunction$4(I)?z=I(j):z=React.createElement(Dot,j),React.createElement(Layer,{className:"recharts-active-dot",key:q},z)});var M=React.forwardRef(function(j,q){return React.createElement(A,_extends({},j,{ref:q}))});return M.displayName=A.displayName,M},AreaChart$1=generateCategoricalChart({chartName:"AreaChart",GraphicalChild:Area,axisComponents:[{axisType:"xAxis",AxisComp:XAxis},{axisType:"yAxis",AxisComp:YAxis}],formatAxisMap});function ChartTooltipContent({active:t,payload:e,label:n,series:o}){if(t&&(e!=null&&e.length)){const l=new Map(o.map(d=>[d.name,d]));return jsxRuntime.jsxs("div",{className:"rounded-lg border bg-background p-2 text-sm shadow-sm",children:[jsxRuntime.jsx("div",{className:"mb-1 font-medium",children:n}),jsxRuntime.jsx("div",{className:"space-y-1",children:e.map(d=>{if(d.value===null||d.value===void 0)return null;const f=l.get(d.dataKey);if(!f)return null;const g=f.format==="money"?formatMoney(d.value):f.unitsPosition==="left"?`${f.units||""}${d.value}`:`${d.value}${f.units?` ${f.units}`:""}`;return jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("span",{className:"mr-2 h-2.5 w-2.5 rounded-full",style:{backgroundColor:f.color??"#000"}}),jsxRuntime.jsx("span",{className:"text-muted-foreground",children:f.label||d.name})]}),jsxRuntime.jsx("span",{className:"font-medium",children:g})]},d.dataKey)})})]})}return null}function AreaChart({data:t,series:e,height:n,className:o,size:l="default"}){if(!(t!=null&&t.length)||!(e!=null&&e.length))return jsxRuntime.jsx("div",{className:cn("flex items-center justify-center text-muted-foreground",o),style:l==="default"?{height:n}:{},children:"No data available"});const d=Object.keys(t[0])[0],f=l==="mini",g=e.filter(R=>R.yAxisId==="left"||!R.yAxisId),b=e.filter(R=>R.yAxisId==="right"),_=R=>{const C=g[0];return(C==null?void 0:C.format)==="money"?formatMoney(R,0):C!=null&&C.units?C.unitsPosition==="left"?`${C.units}${R}`:`${R}${C.units}`:String(R)},S=R=>{const C=b[0];return C!=null&&C.units?C.unitsPosition==="left"?`${C.units}${R}`:`${R}${C.units}`:String(R)};return jsxRuntime.jsx("div",{className:cn("w-full",o),style:{height:n?`${n}px`:"100%"},children:jsxRuntime.jsx(ResponsiveContainer,{width:"100%",height:"100%",children:jsxRuntime.jsxs(AreaChart$1,{data:t,margin:f?{top:0,right:0,left:0,bottom:0}:{top:10,right:30,left:0,bottom:0},children:[jsxRuntime.jsx("defs",{children:e.map(R=>jsxRuntime.jsxs("linearGradient",{id:`gradient-${R.name}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{offset:"5%",stopColor:R.color,stopOpacity:.8}),jsxRuntime.jsx("stop",{offset:"95%",stopColor:R.color,stopOpacity:.1})]},R.name))}),!f&&jsxRuntime.jsx(CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),!f&&jsxRuntime.jsx(XAxis,{dataKey:d,className:"text-xs text-muted-foreground",tickLine:!1,axisLine:!1}),!f&&g.length>0&&jsxRuntime.jsx(YAxis,{yAxisId:"left",className:"text-xs text-muted-foreground",tickLine:!1,axisLine:!1,tickFormatter:_}),!f&&b.length>0&&jsxRuntime.jsx(YAxis,{yAxisId:"right",orientation:"right",className:"text-xs text-muted-foreground",tickLine:!1,axisLine:!1,tickFormatter:S}),!f&&jsxRuntime.jsx(Tooltip,{content:jsxRuntime.jsx(ChartTooltipContent,{series:e}),cursor:{stroke:"var(--muted)",strokeWidth:1}}),e.map(R=>jsxRuntime.jsx(Area,{yAxisId:R.yAxisId||"left",type:"monotone",dataKey:R.name,stroke:R.color,fillOpacity:.6,fill:`url(#gradient-${R.name})`,strokeWidth:f?1:2},R.name))]})})})}/*! *****************************************************************************
596
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray(t,e){if(t){if(typeof t=="string")return _arrayLikeToArray(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(t,e)}}function _iterableToArray(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _arrayLikeToArray(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function ownKeys(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(l){return Object.getOwnPropertyDescriptor(t,l).enumerable})),n.push.apply(n,o)}return n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ownKeys(Object(n),!0).forEach(function(o){_defineProperty(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function _defineProperty(t,e,n){return e=_toPropertyKey(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _toPropertyKey(t){var e=_toPrimitive(t,"string");return _typeof(e)=="symbol"?e:e+""}function _toPrimitive(t,e){if(_typeof(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(_typeof(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ORIENT_MAP={xAxis:["bottom","top"],yAxis:["left","right"]},FULL_WIDTH_AND_HEIGHT={width:"100%",height:"100%"},originCoordinate={x:0,y:0};function renderAsIs(t){return t}var calculateTooltipPos=function(e,n){return n==="horizontal"?e.x:n==="vertical"?e.y:n==="centric"?e.angle:e.radius},getActiveCoordinate=function(e,n,o,l){var d=n.find(function(S){return S&&S.index===o});if(d){if(e==="horizontal")return{x:d.coordinate,y:l.y};if(e==="vertical")return{x:l.x,y:d.coordinate};if(e==="centric"){var f=d.coordinate,g=l.radius;return _objectSpread(_objectSpread(_objectSpread({},l),polarToCartesian(l.cx,l.cy,g,f)),{},{angle:f,radius:g})}var b=d.coordinate,_=l.angle;return _objectSpread(_objectSpread(_objectSpread({},l),polarToCartesian(l.cx,l.cy,b,_)),{},{angle:_,radius:b})}return originCoordinate},getDisplayedData=function(e,n){var o=n.graphicalItems,l=n.dataStartIndex,d=n.dataEndIndex,f=(o??[]).reduce(function(g,b){var _=b.props.data;return _&&_.length?[].concat(_toConsumableArray(g),_toConsumableArray(_)):g},[]);return f.length>0?f:e&&e.length&&isNumber$2(l)&&isNumber$2(d)?e.slice(l,d+1):[]};function getDefaultDomainByAxisType(t){return t==="number"?[0,"auto"]:void 0}var getTooltipContent=function(e,n,o,l){var d=e.graphicalItems,f=e.tooltipAxis,g=getDisplayedData(n,e);return o<0||!d||!d.length||o>=g.length?null:d.reduce(function(b,_){var S,R=(S=_.props.data)!==null&&S!==void 0?S:n;R&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=o&&(R=R.slice(e.dataStartIndex,e.dataEndIndex+1));var C;if(f.dataKey&&!f.allowDuplicatedCategory){var E=R===void 0?g:R;C=findEntryInArray(E,f.dataKey,l)}else C=R&&R[o]||g[o];return C?[].concat(_toConsumableArray(b),[getTooltipItem(_,C)]):b},[])},getTooltipData=function(e,n,o,l){var d=l||{x:e.chartX,y:e.chartY},f=calculateTooltipPos(d,o),g=e.orderedTooltipTicks,b=e.tooltipAxis,_=e.tooltipTicks,S=calculateActiveTickIndex(f,g,_,b);if(S>=0&&_){var R=_[S]&&_[S].value,C=getTooltipContent(e,n,S,R),E=getActiveCoordinate(o,g,S,d);return{activeTooltipIndex:S,activeLabel:R,activePayload:C,activeCoordinate:E}}return null},getAxisMapByAxes=function(e,n){var o=n.axes,l=n.graphicalItems,d=n.axisType,f=n.axisIdKey,g=n.stackGroups,b=n.dataStartIndex,_=n.dataEndIndex,S=e.layout,R=e.children,C=e.stackOffset,E=isCategoricalAxis(S,d);return o.reduce(function(A,M){var I,j=M.type.defaultProps!==void 0?_objectSpread(_objectSpread({},M.type.defaultProps),M.props):M.props,q=j.type,z=j.dataKey,Q=j.allowDataOverflow,F=j.allowDuplicatedCategory,V=j.scale,te=j.ticks,ne=j.includeHidden,se=j[f];if(A[se])return A;var ge=getDisplayedData(e.data,{graphicalItems:l.filter(function(He){var Ze,tt=f in He.props?He.props[f]:(Ze=He.type.defaultProps)===null||Ze===void 0?void 0:Ze[f];return tt===se}),dataStartIndex:b,dataEndIndex:_}),oe=ge.length,Ae,je,Ne;isDomainSpecifiedByUser(j.domain,Q,q)&&(Ae=parseSpecifiedDomain(j.domain,null,Q),E&&(q==="number"||V!=="auto")&&(Ne=getDomainOfDataByKey(ge,z,"category")));var Oe=getDefaultDomainByAxisType(q);if(!Ae||Ae.length===0){var Fe,ze=(Fe=j.domain)!==null&&Fe!==void 0?Fe:Oe;if(z){if(Ae=getDomainOfDataByKey(ge,z,q),q==="category"&&E){var $e=hasDuplicate(Ae);F&&$e?(je=Ae,Ae=range(0,oe)):F||(Ae=parseDomainOfCategoryAxis(ze,Ae,M).reduce(function(He,Ze){return He.indexOf(Ze)>=0?He:[].concat(_toConsumableArray(He),[Ze])},[]))}else if(q==="category")F?Ae=Ae.filter(function(He){return He!==""&&!isNil(He)}):Ae=parseDomainOfCategoryAxis(ze,Ae,M).reduce(function(He,Ze){return He.indexOf(Ze)>=0||Ze===""||isNil(Ze)?He:[].concat(_toConsumableArray(He),[Ze])},[]);else if(q==="number"){var Be=parseErrorBarsOfAxis(ge,l.filter(function(He){var Ze,tt,Ye=f in He.props?He.props[f]:(Ze=He.type.defaultProps)===null||Ze===void 0?void 0:Ze[f],Qe="hide"in He.props?He.props.hide:(tt=He.type.defaultProps)===null||tt===void 0?void 0:tt.hide;return Ye===se&&(ne||!Qe)}),z,d,S);Be&&(Ae=Be)}E&&(q==="number"||V!=="auto")&&(Ne=getDomainOfDataByKey(ge,z,"category"))}else E?Ae=range(0,oe):g&&g[se]&&g[se].hasStack&&q==="number"?Ae=C==="expand"?[0,1]:getDomainOfStackGroups(g[se].stackGroups,b,_):Ae=getDomainOfItemsWithSameAxis(ge,l.filter(function(He){var Ze=f in He.props?He.props[f]:He.type.defaultProps[f],tt="hide"in He.props?He.props.hide:He.type.defaultProps.hide;return Ze===se&&(ne||!tt)}),q,S,!0);if(q==="number")Ae=detectReferenceElementsDomain(R,Ae,se,d,te),ze&&(Ae=parseSpecifiedDomain(ze,Ae,Q));else if(q==="category"&&ze){var qe=ze,Ge=Ae.every(function(He){return qe.indexOf(He)>=0});Ge&&(Ae=qe)}}return _objectSpread(_objectSpread({},A),{},_defineProperty({},se,_objectSpread(_objectSpread({},j),{},{axisType:d,domain:Ae,categoricalDomain:Ne,duplicateDomain:je,originalDomain:(I=j.domain)!==null&&I!==void 0?I:Oe,isCategorical:E,layout:S})))},{})},getAxisMapByItems=function(e,n){var o=n.graphicalItems,l=n.Axis,d=n.axisType,f=n.axisIdKey,g=n.stackGroups,b=n.dataStartIndex,_=n.dataEndIndex,S=e.layout,R=e.children,C=getDisplayedData(e.data,{graphicalItems:o,dataStartIndex:b,dataEndIndex:_}),E=C.length,A=isCategoricalAxis(S,d),M=-1;return o.reduce(function(I,j){var q=j.type.defaultProps!==void 0?_objectSpread(_objectSpread({},j.type.defaultProps),j.props):j.props,z=q[f],Q=getDefaultDomainByAxisType("number");if(!I[z]){M++;var F;return A?F=range(0,E):g&&g[z]&&g[z].hasStack?(F=getDomainOfStackGroups(g[z].stackGroups,b,_),F=detectReferenceElementsDomain(R,F,z,d)):(F=parseSpecifiedDomain(Q,getDomainOfItemsWithSameAxis(C,o.filter(function(V){var te,ne,se=f in V.props?V.props[f]:(te=V.type.defaultProps)===null||te===void 0?void 0:te[f],ge="hide"in V.props?V.props.hide:(ne=V.type.defaultProps)===null||ne===void 0?void 0:ne.hide;return se===z&&!ge}),"number",S),l.defaultProps.allowDataOverflow),F=detectReferenceElementsDomain(R,F,z,d)),_objectSpread(_objectSpread({},I),{},_defineProperty({},z,_objectSpread(_objectSpread({axisType:d},l.defaultProps),{},{hide:!0,orientation:get$1(ORIENT_MAP,"".concat(d,".").concat(M%2),null),domain:F,originalDomain:Q,isCategorical:A,layout:S})))}return I},{})},getAxisMap=function(e,n){var o=n.axisType,l=o===void 0?"xAxis":o,d=n.AxisComp,f=n.graphicalItems,g=n.stackGroups,b=n.dataStartIndex,_=n.dataEndIndex,S=e.children,R="".concat(l,"Id"),C=findAllByType(S,d),E={};return C&&C.length?E=getAxisMapByAxes(e,{axes:C,graphicalItems:f,axisType:l,axisIdKey:R,stackGroups:g,dataStartIndex:b,dataEndIndex:_}):f&&f.length&&(E=getAxisMapByItems(e,{Axis:d,graphicalItems:f,axisType:l,axisIdKey:R,stackGroups:g,dataStartIndex:b,dataEndIndex:_})),E},tooltipTicksGenerator=function(e){var n=getAnyElementOfObject(e),o=getTicksOfAxis(n,!1,!0);return{tooltipTicks:o,orderedTooltipTicks:sortBy(o,function(l){return l.coordinate}),tooltipAxis:n,tooltipAxisBandSize:getBandSizeOfAxis(n,o)}},createDefaultState=function(e){var n=e.children,o=e.defaultShowTooltip,l=findChildByType(n,Brush),d=0,f=0;return e.data&&e.data.length!==0&&(f=e.data.length-1),l&&l.props&&(l.props.startIndex>=0&&(d=l.props.startIndex),l.props.endIndex>=0&&(f=l.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:d,dataEndIndex:f,activeTooltipIndex:-1,isTooltipActive:!!o}},hasGraphicalBarItem=function(e){return!e||!e.length?!1:e.some(function(n){var o=getDisplayName(n&&n.type);return o&&o.indexOf("Bar")>=0})},getAxisNameByLayout=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},calculateOffset=function(e,n){var o=e.props,l=e.graphicalItems,d=e.xAxisMap,f=d===void 0?{}:d,g=e.yAxisMap,b=g===void 0?{}:g,_=o.width,S=o.height,R=o.children,C=o.margin||{},E=findChildByType(R,Brush),A=findChildByType(R,Legend),M=Object.keys(b).reduce(function(F,V){var te=b[V],ne=te.orientation;return!te.mirror&&!te.hide?_objectSpread(_objectSpread({},F),{},_defineProperty({},ne,F[ne]+te.width)):F},{left:C.left||0,right:C.right||0}),I=Object.keys(f).reduce(function(F,V){var te=f[V],ne=te.orientation;return!te.mirror&&!te.hide?_objectSpread(_objectSpread({},F),{},_defineProperty({},ne,get$1(F,"".concat(ne))+te.height)):F},{top:C.top||0,bottom:C.bottom||0}),j=_objectSpread(_objectSpread({},I),M),q=j.bottom;E&&(j.bottom+=E.props.height||Brush.defaultProps.height),A&&n&&(j=appendOffsetOfLegend(j,l,o,n));var z=_-j.left-j.right,Q=S-j.top-j.bottom;return _objectSpread(_objectSpread({brushBottom:q},j),{},{width:Math.max(z,0),height:Math.max(Q,0)})},getCartesianAxisSize=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},generateCategoricalChart=function(e){var n=e.chartName,o=e.GraphicalChild,l=e.defaultTooltipEventType,d=l===void 0?"axis":l,f=e.validateTooltipEventTypes,g=f===void 0?["axis"]:f,b=e.axisComponents,_=e.legendContent,S=e.formatAxisMap,R=e.defaultProps,C=function(j,q){var z=q.graphicalItems,Q=q.stackGroups,F=q.offset,V=q.updateId,te=q.dataStartIndex,ne=q.dataEndIndex,se=j.barSize,ge=j.layout,oe=j.barGap,Ae=j.barCategoryGap,je=j.maxBarSize,Ne=getAxisNameByLayout(ge),Oe=Ne.numericAxisName,Fe=Ne.cateAxisName,ze=hasGraphicalBarItem(z),$e=[];return z.forEach(function(Be,qe){var Ge=getDisplayedData(j.data,{graphicalItems:[Be],dataStartIndex:te,dataEndIndex:ne}),He=Be.type.defaultProps!==void 0?_objectSpread(_objectSpread({},Be.type.defaultProps),Be.props):Be.props,Ze=He.dataKey,tt=He.maxBarSize,Ye=He["".concat(Oe,"Id")],Qe=He["".concat(Fe,"Id")],Xe={},st=b.reduce(function(it,et){var ct,ft,dt=q["".concat(et.axisType,"Map")],Rt=He["".concat(et.axisType,"Id")];dt&&dt[Rt]||et.axisType==="zAxis"||(process.env.NODE_ENV!=="production"?invariant$1(!1,"Specifying a(n) ".concat(et.axisType,"Id requires a corresponding ").concat(et.axisType,"Id on the targeted graphical component ").concat((ct=Be==null||(ft=Be.type)===null||ft===void 0?void 0:ft.displayName)!==null&&ct!==void 0?ct:"")):invariant$1());var zt=dt[Rt];return _objectSpread(_objectSpread({},it),{},_defineProperty(_defineProperty({},et.axisType,zt),"".concat(et.axisType,"Ticks"),getTicksOfAxis(zt)))},Xe),rt=st[Fe],at=st["".concat(Fe,"Ticks")],ot=Q&&Q[Ye]&&Q[Ye].hasStack&&getStackedDataOfItem(Be,Q[Ye].stackGroups),Ue=getDisplayName(Be.type).indexOf("Bar")>=0,Ct=getBandSizeOfAxis(rt,at),Je=[],yt=ze&&getBarSizeList({barSize:se,stackGroups:Q,totalSize:getCartesianAxisSize(st,Fe)});if(Ue){var Mt,qt,Ht=isNil(tt)?je:tt,Ft=(Mt=(qt=getBandSizeOfAxis(rt,at,!0))!==null&&qt!==void 0?qt:Ht)!==null&&Mt!==void 0?Mt:0;Je=getBarPosition({barGap:oe,barCategoryGap:Ae,bandSize:Ft!==Ct?Ft:Ct,sizeList:yt[Qe],maxBarSize:Ht}),Ft!==Ct&&(Je=Je.map(function(it){return _objectSpread(_objectSpread({},it),{},{position:_objectSpread(_objectSpread({},it.position),{},{offset:it.position.offset-Ft/2})})}))}var Ke=Be&&Be.type&&Be.type.getComposedData;Ke&&$e.push({props:_objectSpread(_objectSpread({},Ke(_objectSpread(_objectSpread({},st),{},{displayedData:Ge,props:j,dataKey:Ze,item:Be,bandSize:Ct,barPosition:Je,offset:F,stackedData:ot,layout:ge,dataStartIndex:te,dataEndIndex:ne}))),{},_defineProperty(_defineProperty(_defineProperty({key:Be.key||"item-".concat(qe)},Oe,st[Oe]),Fe,st[Fe]),"animationId",V)),childIndex:parseChildIndex(Be,j.children),item:Be})}),$e},E=function(j,q){var z=j.props,Q=j.dataStartIndex,F=j.dataEndIndex,V=j.updateId;if(!validateWidthHeight({props:z}))return null;var te=z.children,ne=z.layout,se=z.stackOffset,ge=z.data,oe=z.reverseStackOrder,Ae=getAxisNameByLayout(ne),je=Ae.numericAxisName,Ne=Ae.cateAxisName,Oe=findAllByType(te,o),Fe=getStackGroupsByAxisId(ge,Oe,"".concat(je,"Id"),"".concat(Ne,"Id"),se,oe),ze=b.reduce(function(He,Ze){var tt="".concat(Ze.axisType,"Map");return _objectSpread(_objectSpread({},He),{},_defineProperty({},tt,getAxisMap(z,_objectSpread(_objectSpread({},Ze),{},{graphicalItems:Oe,stackGroups:Ze.axisType===je&&Fe,dataStartIndex:Q,dataEndIndex:F}))))},{}),$e=calculateOffset(_objectSpread(_objectSpread({},ze),{},{props:z,graphicalItems:Oe}),q==null?void 0:q.legendBBox);Object.keys(ze).forEach(function(He){ze[He]=S(z,ze[He],$e,He.replace("Map",""),n)});var Be=ze["".concat(Ne,"Map")],qe=tooltipTicksGenerator(Be),Ge=C(z,_objectSpread(_objectSpread({},ze),{},{dataStartIndex:Q,dataEndIndex:F,updateId:V,graphicalItems:Oe,stackGroups:Fe,offset:$e}));return _objectSpread(_objectSpread({formattedGraphicalItems:Ge,graphicalItems:Oe,offset:$e,stackGroups:Fe},qe),ze)},A=function(I){function j(q){var z,Q,F;return _classCallCheck(this,j),F=_callSuper(this,j,[q]),_defineProperty(F,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),_defineProperty(F,"accessibilityManager",new AccessibilityManager),_defineProperty(F,"handleLegendBBoxUpdate",function(V){if(V){var te=F.state,ne=te.dataStartIndex,se=te.dataEndIndex,ge=te.updateId;F.setState(_objectSpread({legendBBox:V},E({props:F.props,dataStartIndex:ne,dataEndIndex:se,updateId:ge},_objectSpread(_objectSpread({},F.state),{},{legendBBox:V}))))}}),_defineProperty(F,"handleReceiveSyncEvent",function(V,te,ne){if(F.props.syncId===V){if(ne===F.eventEmitterSymbol&&typeof F.props.syncMethod!="function")return;F.applySyncEvent(te)}}),_defineProperty(F,"handleBrushChange",function(V){var te=V.startIndex,ne=V.endIndex;if(te!==F.state.dataStartIndex||ne!==F.state.dataEndIndex){var se=F.state.updateId;F.setState(function(){return _objectSpread({dataStartIndex:te,dataEndIndex:ne},E({props:F.props,dataStartIndex:te,dataEndIndex:ne,updateId:se},F.state))}),F.triggerSyncEvent({dataStartIndex:te,dataEndIndex:ne})}}),_defineProperty(F,"handleMouseEnter",function(V){var te=F.getMouseInfo(V);if(te){var ne=_objectSpread(_objectSpread({},te),{},{isTooltipActive:!0});F.setState(ne),F.triggerSyncEvent(ne);var se=F.props.onMouseEnter;isFunction$4(se)&&se(ne,V)}}),_defineProperty(F,"triggeredAfterMouseMove",function(V){var te=F.getMouseInfo(V),ne=te?_objectSpread(_objectSpread({},te),{},{isTooltipActive:!0}):{isTooltipActive:!1};F.setState(ne),F.triggerSyncEvent(ne);var se=F.props.onMouseMove;isFunction$4(se)&&se(ne,V)}),_defineProperty(F,"handleItemMouseEnter",function(V){F.setState(function(){return{isTooltipActive:!0,activeItem:V,activePayload:V.tooltipPayload,activeCoordinate:V.tooltipPosition||{x:V.cx,y:V.cy}}})}),_defineProperty(F,"handleItemMouseLeave",function(){F.setState(function(){return{isTooltipActive:!1}})}),_defineProperty(F,"handleMouseMove",function(V){V.persist(),F.throttleTriggeredAfterMouseMove(V)}),_defineProperty(F,"handleMouseLeave",function(V){F.throttleTriggeredAfterMouseMove.cancel();var te={isTooltipActive:!1};F.setState(te),F.triggerSyncEvent(te);var ne=F.props.onMouseLeave;isFunction$4(ne)&&ne(te,V)}),_defineProperty(F,"handleOuterEvent",function(V){var te=getReactEventByType(V),ne=get$1(F.props,"".concat(te));if(te&&isFunction$4(ne)){var se,ge;/.*touch.*/i.test(te)?ge=F.getMouseInfo(V.changedTouches[0]):ge=F.getMouseInfo(V),ne((se=ge)!==null&&se!==void 0?se:{},V)}}),_defineProperty(F,"handleClick",function(V){var te=F.getMouseInfo(V);if(te){var ne=_objectSpread(_objectSpread({},te),{},{isTooltipActive:!0});F.setState(ne),F.triggerSyncEvent(ne);var se=F.props.onClick;isFunction$4(se)&&se(ne,V)}}),_defineProperty(F,"handleMouseDown",function(V){var te=F.props.onMouseDown;if(isFunction$4(te)){var ne=F.getMouseInfo(V);te(ne,V)}}),_defineProperty(F,"handleMouseUp",function(V){var te=F.props.onMouseUp;if(isFunction$4(te)){var ne=F.getMouseInfo(V);te(ne,V)}}),_defineProperty(F,"handleTouchMove",function(V){V.changedTouches!=null&&V.changedTouches.length>0&&F.throttleTriggeredAfterMouseMove(V.changedTouches[0])}),_defineProperty(F,"handleTouchStart",function(V){V.changedTouches!=null&&V.changedTouches.length>0&&F.handleMouseDown(V.changedTouches[0])}),_defineProperty(F,"handleTouchEnd",function(V){V.changedTouches!=null&&V.changedTouches.length>0&&F.handleMouseUp(V.changedTouches[0])}),_defineProperty(F,"handleDoubleClick",function(V){var te=F.props.onDoubleClick;if(isFunction$4(te)){var ne=F.getMouseInfo(V);te(ne,V)}}),_defineProperty(F,"handleContextMenu",function(V){var te=F.props.onContextMenu;if(isFunction$4(te)){var ne=F.getMouseInfo(V);te(ne,V)}}),_defineProperty(F,"triggerSyncEvent",function(V){F.props.syncId!==void 0&&eventCenter.emit(SYNC_EVENT,F.props.syncId,V,F.eventEmitterSymbol)}),_defineProperty(F,"applySyncEvent",function(V){var te=F.props,ne=te.layout,se=te.syncMethod,ge=F.state.updateId,oe=V.dataStartIndex,Ae=V.dataEndIndex;if(V.dataStartIndex!==void 0||V.dataEndIndex!==void 0)F.setState(_objectSpread({dataStartIndex:oe,dataEndIndex:Ae},E({props:F.props,dataStartIndex:oe,dataEndIndex:Ae,updateId:ge},F.state)));else if(V.activeTooltipIndex!==void 0){var je=V.chartX,Ne=V.chartY,Oe=V.activeTooltipIndex,Fe=F.state,ze=Fe.offset,$e=Fe.tooltipTicks;if(!ze)return;if(typeof se=="function")Oe=se($e,V);else if(se==="value"){Oe=-1;for(var Be=0;Be<$e.length;Be++)if($e[Be].value===V.activeLabel){Oe=Be;break}}var qe=_objectSpread(_objectSpread({},ze),{},{x:ze.left,y:ze.top}),Ge=Math.min(je,qe.x+qe.width),He=Math.min(Ne,qe.y+qe.height),Ze=$e[Oe]&&$e[Oe].value,tt=getTooltipContent(F.state,F.props.data,Oe),Ye=$e[Oe]?{x:ne==="horizontal"?$e[Oe].coordinate:Ge,y:ne==="horizontal"?He:$e[Oe].coordinate}:originCoordinate;F.setState(_objectSpread(_objectSpread({},V),{},{activeLabel:Ze,activeCoordinate:Ye,activePayload:tt,activeTooltipIndex:Oe}))}else F.setState(V)}),_defineProperty(F,"renderCursor",function(V){var te,ne=F.state,se=ne.isTooltipActive,ge=ne.activeCoordinate,oe=ne.activePayload,Ae=ne.offset,je=ne.activeTooltipIndex,Ne=ne.tooltipAxisBandSize,Oe=F.getTooltipEventType(),Fe=(te=V.props.active)!==null&&te!==void 0?te:se,ze=F.props.layout,$e=V.key||"_recharts-cursor";return React.createElement(Cursor,{key:$e,activeCoordinate:ge,activePayload:oe,activeTooltipIndex:je,chartName:n,element:V,isActive:Fe,layout:ze,offset:Ae,tooltipAxisBandSize:Ne,tooltipEventType:Oe})}),_defineProperty(F,"renderPolarAxis",function(V,te,ne){var se=get$1(V,"type.axisType"),ge=get$1(F.state,"".concat(se,"Map")),oe=V.type.defaultProps,Ae=oe!==void 0?_objectSpread(_objectSpread({},oe),V.props):V.props,je=ge&&ge[Ae["".concat(se,"Id")]];return React.cloneElement(V,_objectSpread(_objectSpread({},je),{},{className:clsx(se,je.className),key:V.key||"".concat(te,"-").concat(ne),ticks:getTicksOfAxis(je,!0)}))}),_defineProperty(F,"renderPolarGrid",function(V){var te=V.props,ne=te.radialLines,se=te.polarAngles,ge=te.polarRadius,oe=F.state,Ae=oe.radiusAxisMap,je=oe.angleAxisMap,Ne=getAnyElementOfObject(Ae),Oe=getAnyElementOfObject(je),Fe=Oe.cx,ze=Oe.cy,$e=Oe.innerRadius,Be=Oe.outerRadius;return React.cloneElement(V,{polarAngles:Array.isArray(se)?se:getTicksOfAxis(Oe,!0).map(function(qe){return qe.coordinate}),polarRadius:Array.isArray(ge)?ge:getTicksOfAxis(Ne,!0).map(function(qe){return qe.coordinate}),cx:Fe,cy:ze,innerRadius:$e,outerRadius:Be,key:V.key||"polar-grid",radialLines:ne})}),_defineProperty(F,"renderLegend",function(){var V=F.state.formattedGraphicalItems,te=F.props,ne=te.children,se=te.width,ge=te.height,oe=F.props.margin||{},Ae=se-(oe.left||0)-(oe.right||0),je=getLegendProps({children:ne,formattedGraphicalItems:V,legendWidth:Ae,legendContent:_});if(!je)return null;var Ne=je.item,Oe=_objectWithoutProperties(je,_excluded);return React.cloneElement(Ne,_objectSpread(_objectSpread({},Oe),{},{chartWidth:se,chartHeight:ge,margin:oe,onBBoxUpdate:F.handleLegendBBoxUpdate}))}),_defineProperty(F,"renderTooltip",function(){var V,te=F.props,ne=te.children,se=te.accessibilityLayer,ge=findChildByType(ne,Tooltip);if(!ge)return null;var oe=F.state,Ae=oe.isTooltipActive,je=oe.activeCoordinate,Ne=oe.activePayload,Oe=oe.activeLabel,Fe=oe.offset,ze=(V=ge.props.active)!==null&&V!==void 0?V:Ae;return React.cloneElement(ge,{viewBox:_objectSpread(_objectSpread({},Fe),{},{x:Fe.left,y:Fe.top}),active:ze,label:Oe,payload:ze?Ne:[],coordinate:je,accessibilityLayer:se})}),_defineProperty(F,"renderBrush",function(V){var te=F.props,ne=te.margin,se=te.data,ge=F.state,oe=ge.offset,Ae=ge.dataStartIndex,je=ge.dataEndIndex,Ne=ge.updateId;return React.cloneElement(V,{key:V.key||"_recharts-brush",onChange:combineEventHandlers(F.handleBrushChange,V.props.onChange),data:se,x:isNumber$2(V.props.x)?V.props.x:oe.left,y:isNumber$2(V.props.y)?V.props.y:oe.top+oe.height+oe.brushBottom-(ne.bottom||0),width:isNumber$2(V.props.width)?V.props.width:oe.width,startIndex:Ae,endIndex:je,updateId:"brush-".concat(Ne)})}),_defineProperty(F,"renderReferenceElement",function(V,te,ne){if(!V)return null;var se=F,ge=se.clipPathId,oe=F.state,Ae=oe.xAxisMap,je=oe.yAxisMap,Ne=oe.offset,Oe=V.type.defaultProps||{},Fe=V.props,ze=Fe.xAxisId,$e=ze===void 0?Oe.xAxisId:ze,Be=Fe.yAxisId,qe=Be===void 0?Oe.yAxisId:Be;return React.cloneElement(V,{key:V.key||"".concat(te,"-").concat(ne),xAxis:Ae[$e],yAxis:je[qe],viewBox:{x:Ne.left,y:Ne.top,width:Ne.width,height:Ne.height},clipPathId:ge})}),_defineProperty(F,"renderActivePoints",function(V){var te=V.item,ne=V.activePoint,se=V.basePoint,ge=V.childIndex,oe=V.isRange,Ae=[],je=te.props.key,Ne=te.item.type.defaultProps!==void 0?_objectSpread(_objectSpread({},te.item.type.defaultProps),te.item.props):te.item.props,Oe=Ne.activeDot,Fe=Ne.dataKey,ze=_objectSpread(_objectSpread({index:ge,dataKey:Fe,cx:ne.x,cy:ne.y,r:4,fill:getMainColorOfGraphicItem(te.item),strokeWidth:2,stroke:"#fff",payload:ne.payload,value:ne.value},filterProps(Oe,!1)),adaptEventHandlers(Oe));return Ae.push(j.renderActiveDot(Oe,ze,"".concat(je,"-activePoint-").concat(ge))),se?Ae.push(j.renderActiveDot(Oe,_objectSpread(_objectSpread({},ze),{},{cx:se.x,cy:se.y}),"".concat(je,"-basePoint-").concat(ge))):oe&&Ae.push(null),Ae}),_defineProperty(F,"renderGraphicChild",function(V,te,ne){var se=F.filterFormatItem(V,te,ne);if(!se)return null;var ge=F.getTooltipEventType(),oe=F.state,Ae=oe.isTooltipActive,je=oe.tooltipAxis,Ne=oe.activeTooltipIndex,Oe=oe.activeLabel,Fe=F.props.children,ze=findChildByType(Fe,Tooltip),$e=se.props,Be=$e.points,qe=$e.isRange,Ge=$e.baseLine,He=se.item.type.defaultProps!==void 0?_objectSpread(_objectSpread({},se.item.type.defaultProps),se.item.props):se.item.props,Ze=He.activeDot,tt=He.hide,Ye=He.activeBar,Qe=He.activeShape,Xe=!!(!tt&&Ae&&ze&&(Ze||Ye||Qe)),st={};ge!=="axis"&&ze&&ze.props.trigger==="click"?st={onClick:combineEventHandlers(F.handleItemMouseEnter,V.props.onClick)}:ge!=="axis"&&(st={onMouseLeave:combineEventHandlers(F.handleItemMouseLeave,V.props.onMouseLeave),onMouseEnter:combineEventHandlers(F.handleItemMouseEnter,V.props.onMouseEnter)});var rt=React.cloneElement(V,_objectSpread(_objectSpread({},se.props),st));function at(et){return typeof je.dataKey=="function"?je.dataKey(et.payload):null}if(Xe)if(Ne>=0){var ot,Ue;if(je.dataKey&&!je.allowDuplicatedCategory){var Ct=typeof je.dataKey=="function"?at:"payload.".concat(je.dataKey.toString());ot=findEntryInArray(Be,Ct,Oe),Ue=qe&&Ge&&findEntryInArray(Ge,Ct,Oe)}else ot=Be==null?void 0:Be[Ne],Ue=qe&&Ge&&Ge[Ne];if(Qe||Ye){var Je=V.props.activeIndex!==void 0?V.props.activeIndex:Ne;return[React.cloneElement(V,_objectSpread(_objectSpread(_objectSpread({},se.props),st),{},{activeIndex:Je})),null,null]}if(!isNil(ot))return[rt].concat(_toConsumableArray(F.renderActivePoints({item:se,activePoint:ot,basePoint:Ue,childIndex:Ne,isRange:qe})))}else{var yt,Mt=(yt=F.getItemByXY(F.state.activeCoordinate))!==null&&yt!==void 0?yt:{graphicalItem:rt},qt=Mt.graphicalItem,Ht=qt.item,Ft=Ht===void 0?V:Ht,Ke=qt.childIndex,it=_objectSpread(_objectSpread(_objectSpread({},se.props),st),{},{activeIndex:Ke});return[React.cloneElement(Ft,it),null,null]}return qe?[rt,null,null]:[rt,null]}),_defineProperty(F,"renderCustomized",function(V,te,ne){return React.cloneElement(V,_objectSpread(_objectSpread({key:"recharts-customized-".concat(ne)},F.props),F.state))}),_defineProperty(F,"renderMap",{CartesianGrid:{handler:renderAsIs,once:!0},ReferenceArea:{handler:F.renderReferenceElement},ReferenceLine:{handler:renderAsIs},ReferenceDot:{handler:F.renderReferenceElement},XAxis:{handler:renderAsIs},YAxis:{handler:renderAsIs},Brush:{handler:F.renderBrush,once:!0},Bar:{handler:F.renderGraphicChild},Line:{handler:F.renderGraphicChild},Area:{handler:F.renderGraphicChild},Radar:{handler:F.renderGraphicChild},RadialBar:{handler:F.renderGraphicChild},Scatter:{handler:F.renderGraphicChild},Pie:{handler:F.renderGraphicChild},Funnel:{handler:F.renderGraphicChild},Tooltip:{handler:F.renderCursor,once:!0},PolarGrid:{handler:F.renderPolarGrid,once:!0},PolarAngleAxis:{handler:F.renderPolarAxis},PolarRadiusAxis:{handler:F.renderPolarAxis},Customized:{handler:F.renderCustomized}}),F.clipPathId="".concat((z=q.id)!==null&&z!==void 0?z:uniqueId("recharts"),"-clip"),F.throttleTriggeredAfterMouseMove=throttle(F.triggeredAfterMouseMove,(Q=q.throttleDelay)!==null&&Q!==void 0?Q:1e3/60),F.state={},F}return _inherits(j,I),_createClass(j,[{key:"componentDidMount",value:function(){var z,Q;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(z=this.props.margin.left)!==null&&z!==void 0?z:0,top:(Q=this.props.margin.top)!==null&&Q!==void 0?Q:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var z=this.props,Q=z.children,F=z.data,V=z.height,te=z.layout,ne=findChildByType(Q,Tooltip);if(ne){var se=ne.props.defaultIndex;if(!(typeof se!="number"||se<0||se>this.state.tooltipTicks.length-1)){var ge=this.state.tooltipTicks[se]&&this.state.tooltipTicks[se].value,oe=getTooltipContent(this.state,F,se,ge),Ae=this.state.tooltipTicks[se].coordinate,je=(this.state.offset.top+V)/2,Ne=te==="horizontal",Oe=Ne?{x:Ae,y:je}:{y:Ae,x:je},Fe=this.state.formattedGraphicalItems.find(function($e){var Be=$e.item;return Be.type.name==="Scatter"});Fe&&(Oe=_objectSpread(_objectSpread({},Oe),Fe.props.points[se].tooltipPosition),oe=Fe.props.points[se].tooltipPayload);var ze={activeTooltipIndex:se,isTooltipActive:!0,activeLabel:ge,activePayload:oe,activeCoordinate:Oe};this.setState(ze),this.renderCursor(ne),this.accessibilityManager.setIndex(se)}}}},{key:"getSnapshotBeforeUpdate",value:function(z,Q){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==Q.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==z.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==z.margin){var F,V;this.accessibilityManager.setDetails({offset:{left:(F=this.props.margin.left)!==null&&F!==void 0?F:0,top:(V=this.props.margin.top)!==null&&V!==void 0?V:0}})}return null}},{key:"componentDidUpdate",value:function(z){isChildrenEqual([findChildByType(z.children,Tooltip)],[findChildByType(this.props.children,Tooltip)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var z=findChildByType(this.props.children,Tooltip);if(z&&typeof z.props.shared=="boolean"){var Q=z.props.shared?"axis":"item";return g.indexOf(Q)>=0?Q:d}return d}},{key:"getMouseInfo",value:function(z){if(!this.container)return null;var Q=this.container,F=Q.getBoundingClientRect(),V=getOffset(F),te={chartX:Math.round(z.pageX-V.left),chartY:Math.round(z.pageY-V.top)},ne=F.width/Q.offsetWidth||1,se=this.inRange(te.chartX,te.chartY,ne);if(!se)return null;var ge=this.state,oe=ge.xAxisMap,Ae=ge.yAxisMap,je=this.getTooltipEventType(),Ne=getTooltipData(this.state,this.props.data,this.props.layout,se);if(je!=="axis"&&oe&&Ae){var Oe=getAnyElementOfObject(oe).scale,Fe=getAnyElementOfObject(Ae).scale,ze=Oe&&Oe.invert?Oe.invert(te.chartX):null,$e=Fe&&Fe.invert?Fe.invert(te.chartY):null;return _objectSpread(_objectSpread({},te),{},{xValue:ze,yValue:$e},Ne)}return Ne?_objectSpread(_objectSpread({},te),Ne):null}},{key:"inRange",value:function(z,Q){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=this.props.layout,te=z/F,ne=Q/F;if(V==="horizontal"||V==="vertical"){var se=this.state.offset,ge=te>=se.left&&te<=se.left+se.width&&ne>=se.top&&ne<=se.top+se.height;return ge?{x:te,y:ne}:null}var oe=this.state,Ae=oe.angleAxisMap,je=oe.radiusAxisMap;if(Ae&&je){var Ne=getAnyElementOfObject(Ae);return inRangeOfSector({x:te,y:ne},Ne)}return null}},{key:"parseEventsOfWrapper",value:function(){var z=this.props.children,Q=this.getTooltipEventType(),F=findChildByType(z,Tooltip),V={};F&&Q==="axis"&&(F.props.trigger==="click"?V={onClick:this.handleClick}:V={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var te=adaptEventHandlers(this.props,this.handleOuterEvent);return _objectSpread(_objectSpread({},te),V)}},{key:"addListener",value:function(){eventCenter.on(SYNC_EVENT,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){eventCenter.removeListener(SYNC_EVENT,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(z,Q,F){for(var V=this.state.formattedGraphicalItems,te=0,ne=V.length;te<ne;te++){var se=V[te];if(se.item===z||se.props.key===z.key||Q===getDisplayName(se.item.type)&&F===se.childIndex)return se}return null}},{key:"renderClipPath",value:function(){var z=this.clipPathId,Q=this.state.offset,F=Q.left,V=Q.top,te=Q.height,ne=Q.width;return React.createElement("defs",null,React.createElement("clipPath",{id:z},React.createElement("rect",{x:F,y:V,height:te,width:ne})))}},{key:"getXScales",value:function(){var z=this.state.xAxisMap;return z?Object.entries(z).reduce(function(Q,F){var V=_slicedToArray(F,2),te=V[0],ne=V[1];return _objectSpread(_objectSpread({},Q),{},_defineProperty({},te,ne.scale))},{}):null}},{key:"getYScales",value:function(){var z=this.state.yAxisMap;return z?Object.entries(z).reduce(function(Q,F){var V=_slicedToArray(F,2),te=V[0],ne=V[1];return _objectSpread(_objectSpread({},Q),{},_defineProperty({},te,ne.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(z){var Q;return(Q=this.state.xAxisMap)===null||Q===void 0||(Q=Q[z])===null||Q===void 0?void 0:Q.scale}},{key:"getYScaleByAxisId",value:function(z){var Q;return(Q=this.state.yAxisMap)===null||Q===void 0||(Q=Q[z])===null||Q===void 0?void 0:Q.scale}},{key:"getItemByXY",value:function(z){var Q=this.state,F=Q.formattedGraphicalItems,V=Q.activeItem;if(F&&F.length)for(var te=0,ne=F.length;te<ne;te++){var se=F[te],ge=se.props,oe=se.item,Ae=oe.type.defaultProps!==void 0?_objectSpread(_objectSpread({},oe.type.defaultProps),oe.props):oe.props,je=getDisplayName(oe.type);if(je==="Bar"){var Ne=(ge.data||[]).find(function($e){return isInRectangle(z,$e)});if(Ne)return{graphicalItem:se,payload:Ne}}else if(je==="RadialBar"){var Oe=(ge.data||[]).find(function($e){return inRangeOfSector(z,$e)});if(Oe)return{graphicalItem:se,payload:Oe}}else if(isFunnel(se,V)||isPie(se,V)||isScatter(se,V)){var Fe=getActiveShapeIndexForTooltip({graphicalItem:se,activeTooltipItem:V,itemData:Ae.data}),ze=Ae.activeIndex===void 0?Fe:Ae.activeIndex;return{graphicalItem:_objectSpread(_objectSpread({},se),{},{childIndex:ze}),payload:isScatter(se,V)?Ae.data[Fe]:se.props.data[Fe]}}}return null}},{key:"render",value:function(){var z=this;if(!validateWidthHeight(this))return null;var Q=this.props,F=Q.children,V=Q.className,te=Q.width,ne=Q.height,se=Q.style,ge=Q.compact,oe=Q.title,Ae=Q.desc,je=_objectWithoutProperties(Q,_excluded2),Ne=filterProps(je,!1);if(ge)return React.createElement(ChartLayoutContextProvider,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},React.createElement(Surface,_extends({},Ne,{width:te,height:ne,title:oe,desc:Ae}),this.renderClipPath(),renderByOrder(F,this.renderMap)));if(this.props.accessibilityLayer){var Oe,Fe;Ne.tabIndex=(Oe=this.props.tabIndex)!==null&&Oe!==void 0?Oe:0,Ne.role=(Fe=this.props.role)!==null&&Fe!==void 0?Fe:"application",Ne.onKeyDown=function($e){z.accessibilityManager.keyboardEvent($e)},Ne.onFocus=function(){z.accessibilityManager.focus()}}var ze=this.parseEventsOfWrapper();return React.createElement(ChartLayoutContextProvider,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},React.createElement("div",_extends({className:clsx("recharts-wrapper",V),style:_objectSpread({position:"relative",cursor:"default",width:te,height:ne},se)},ze,{ref:function(Be){z.container=Be}}),React.createElement(Surface,_extends({},Ne,{width:te,height:ne,title:oe,desc:Ae,style:FULL_WIDTH_AND_HEIGHT}),this.renderClipPath(),renderByOrder(F,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(React.Component);_defineProperty(A,"displayName",n),_defineProperty(A,"defaultProps",_objectSpread({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},R)),_defineProperty(A,"getDerivedStateFromProps",function(I,j){var q=I.dataKey,z=I.data,Q=I.children,F=I.width,V=I.height,te=I.layout,ne=I.stackOffset,se=I.margin,ge=j.dataStartIndex,oe=j.dataEndIndex;if(j.updateId===void 0){var Ae=createDefaultState(I);return _objectSpread(_objectSpread(_objectSpread({},Ae),{},{updateId:0},E(_objectSpread(_objectSpread({props:I},Ae),{},{updateId:0}),j)),{},{prevDataKey:q,prevData:z,prevWidth:F,prevHeight:V,prevLayout:te,prevStackOffset:ne,prevMargin:se,prevChildren:Q})}if(q!==j.prevDataKey||z!==j.prevData||F!==j.prevWidth||V!==j.prevHeight||te!==j.prevLayout||ne!==j.prevStackOffset||!shallowEqual(se,j.prevMargin)){var je=createDefaultState(I),Ne={chartX:j.chartX,chartY:j.chartY,isTooltipActive:j.isTooltipActive},Oe=_objectSpread(_objectSpread({},getTooltipData(j,z,te)),{},{updateId:j.updateId+1}),Fe=_objectSpread(_objectSpread(_objectSpread({},je),Ne),Oe);return _objectSpread(_objectSpread(_objectSpread({},Fe),E(_objectSpread({props:I},Fe),j)),{},{prevDataKey:q,prevData:z,prevWidth:F,prevHeight:V,prevLayout:te,prevStackOffset:ne,prevMargin:se,prevChildren:Q})}if(!isChildrenEqual(Q,j.prevChildren)){var ze,$e,Be,qe,Ge=findChildByType(Q,Brush),He=Ge&&(ze=($e=Ge.props)===null||$e===void 0?void 0:$e.startIndex)!==null&&ze!==void 0?ze:ge,Ze=Ge&&(Be=(qe=Ge.props)===null||qe===void 0?void 0:qe.endIndex)!==null&&Be!==void 0?Be:oe,tt=He!==ge||Ze!==oe,Ye=!isNil(z),Qe=Ye&&!tt?j.updateId:j.updateId+1;return _objectSpread(_objectSpread({updateId:Qe},E(_objectSpread(_objectSpread({props:I},j),{},{updateId:Qe,dataStartIndex:He,dataEndIndex:Ze}),j)),{},{prevChildren:Q,dataStartIndex:He,dataEndIndex:Ze})}return null}),_defineProperty(A,"renderActiveDot",function(I,j,q){var z;return React.isValidElement(I)?z=React.cloneElement(I,j):isFunction$4(I)?z=I(j):z=React.createElement(Dot,j),React.createElement(Layer,{className:"recharts-active-dot",key:q},z)});var M=React.forwardRef(function(j,q){return React.createElement(A,_extends({},j,{ref:q}))});return M.displayName=A.displayName,M},AreaChart$1=generateCategoricalChart({chartName:"AreaChart",GraphicalChild:Area,axisComponents:[{axisType:"xAxis",AxisComp:XAxis},{axisType:"yAxis",AxisComp:YAxis}],formatAxisMap});function ChartTooltipContent({active:t,payload:e,label:n,series:o}){if(t&&(e!=null&&e.length)){const l=new Map(o.map(d=>[d.name,d]));return jsxRuntime.jsxs("div",{className:"rounded-lg border bg-background p-2 text-sm shadow-sm",children:[jsxRuntime.jsx("div",{className:"mb-1 font-medium",children:n}),jsxRuntime.jsx("div",{className:"space-y-1",children:e.map(d=>{if(d.value===null||d.value===void 0)return null;const f=l.get(d.dataKey);if(!f)return null;const g=f.format==="money"&&typeof d.value=="number"?formatMoney(d.value):f.format==="integer"&&typeof d.value=="number"?formatNumber(d.value,{maximumFractionDigits:2}):f.unitsPosition==="left"?`${f.units||""}${d.value}`:`${d.value}${f.units?` ${f.units}`:""}`;return jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("span",{className:"mr-2 h-2.5 w-2.5 rounded-full",style:{backgroundColor:f.color??"#000"}}),jsxRuntime.jsx("span",{className:"text-muted-foreground",children:f.label||d.name})]}),jsxRuntime.jsx("span",{className:"font-medium",children:g})]},d.dataKey)})})]})}return null}function AreaChart({data:t,series:e,height:n,className:o,size:l="default"}){if(!(t!=null&&t.length)||!(e!=null&&e.length))return jsxRuntime.jsx("div",{className:cn("flex items-center justify-center text-muted-foreground",o),style:l==="default"?{height:n}:{},children:"No data available"});const d=Object.keys(t[0])[0],f=l==="mini",g=e.filter(R=>R.yAxisId==="left"||!R.yAxisId),b=e.filter(R=>R.yAxisId==="right"),_=R=>{const C=g[0];return(C==null?void 0:C.format)==="money"?formatMoney(R,{minimumFractionDigits:0,maximumFractionDigits:0}):C!=null&&C.units?C.unitsPosition==="left"?`${C.units}${R}`:`${R}${C.units}`:String(R)},S=R=>{const C=b[0];return(C==null?void 0:C.format)==="money"?formatMoney(R,{minimumFractionDigits:0,maximumFractionDigits:0}):C!=null&&C.units?C.unitsPosition==="left"?`${C.units}${R}`:`${R}${C.units}`:String(R)};return jsxRuntime.jsx("div",{className:cn("w-full",o),style:{height:n?`${n}px`:"100%"},children:jsxRuntime.jsx(ResponsiveContainer,{width:"100%",height:"100%",children:jsxRuntime.jsxs(AreaChart$1,{data:t,margin:f?{top:0,right:0,left:0,bottom:0}:{top:10,right:30,left:0,bottom:0},children:[jsxRuntime.jsx("defs",{children:e.map(R=>jsxRuntime.jsxs("linearGradient",{id:`gradient-${R.name}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{offset:"5%",stopColor:R.color,stopOpacity:.8}),jsxRuntime.jsx("stop",{offset:"95%",stopColor:R.color,stopOpacity:.1})]},R.name))}),!f&&jsxRuntime.jsx(CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),!f&&jsxRuntime.jsx(XAxis,{dataKey:d,className:"text-xs text-muted-foreground",tickLine:!1,axisLine:!1}),!f&&g.length>0&&jsxRuntime.jsx(YAxis,{yAxisId:"left",className:"text-xs text-muted-foreground",tickLine:!1,axisLine:!1,tickFormatter:_}),!f&&b.length>0&&jsxRuntime.jsx(YAxis,{yAxisId:"right",orientation:"right",className:"text-xs text-muted-foreground",tickLine:!1,axisLine:!1,tickFormatter:S}),!f&&jsxRuntime.jsx(Tooltip,{content:jsxRuntime.jsx(ChartTooltipContent,{series:e}),cursor:{stroke:"var(--muted)",strokeWidth:1}}),e.map(R=>jsxRuntime.jsx(Area,{yAxisId:R.yAxisId||"left",type:"monotone",dataKey:R.name,stroke:R.color,fillOpacity:.6,fill:`url(#gradient-${R.name})`,strokeWidth:f?1:2},R.name))]})})})}/*! *****************************************************************************
597
597
  Copyright (c) Microsoft Corporation.
598
598
 
599
599
  Permission to use, copy, modify, and/or distribute this software for any
@@ -1055,7 +1055,7 @@ ${t}</tr>
1055
1055
  `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${escape2(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){const o=this.parser.parseInline(n),l=cleanUrl(t);if(l===null)return o;t=l;let d='<a href="'+t+'"';return e&&(d+=' title="'+escape2(e)+'"'),d+=">"+o+"</a>",d}image({href:t,title:e,text:n,tokens:o}){o&&(n=this.parser.parseInline(o,this.parser.textRenderer));const l=cleanUrl(t);if(l===null)return escape2(n);t=l;let d=`<img src="${t}" alt="${n}"`;return e&&(d+=` title="${escape2(e)}"`),d+=">",d}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:escape2(t.text)}},_TextRenderer=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},_Parser=class vn{constructor(e){Qt(this,"options");Qt(this,"renderer");Qt(this,"textRenderer");this.options=e||_defaults,this.options.renderer=this.options.renderer||new _Renderer,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _TextRenderer}static parse(e,n){return new vn(n).parse(e)}static parseInline(e,n){return new vn(n).parseInline(e)}parse(e,n=!0){var l,d;let o="";for(let f=0;f<e.length;f++){const g=e[f];if((d=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&d[g.type]){const _=g,S=this.options.extensions.renderers[_.type].call({parser:this},_);if(S!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(_.type)){o+=S||"";continue}}const b=g;switch(b.type){case"space":{o+=this.renderer.space(b);continue}case"hr":{o+=this.renderer.hr(b);continue}case"heading":{o+=this.renderer.heading(b);continue}case"code":{o+=this.renderer.code(b);continue}case"table":{o+=this.renderer.table(b);continue}case"blockquote":{o+=this.renderer.blockquote(b);continue}case"list":{o+=this.renderer.list(b);continue}case"html":{o+=this.renderer.html(b);continue}case"paragraph":{o+=this.renderer.paragraph(b);continue}case"text":{let _=b,S=this.renderer.text(_);for(;f+1<e.length&&e[f+1].type==="text";)_=e[++f],S+=`
1056
1056
  `+this.renderer.text(_);n?o+=this.renderer.paragraph({type:"paragraph",raw:S,text:S,tokens:[{type:"text",raw:S,text:S,escaped:!0}]}):o+=S;continue}default:{const _='Token with "'+b.type+'" type was not found.';if(this.options.silent)return console.error(_),"";throw new Error(_)}}}return o}parseInline(e,n=this.renderer){var l,d;let o="";for(let f=0;f<e.length;f++){const g=e[f];if((d=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&d[g.type]){const _=this.options.extensions.renderers[g.type].call({parser:this},g);if(_!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(g.type)){o+=_||"";continue}}const b=g;switch(b.type){case"escape":{o+=n.text(b);break}case"html":{o+=n.html(b);break}case"link":{o+=n.link(b);break}case"image":{o+=n.image(b);break}case"strong":{o+=n.strong(b);break}case"em":{o+=n.em(b);break}case"codespan":{o+=n.codespan(b);break}case"br":{o+=n.br(b);break}case"del":{o+=n.del(b);break}case"text":{o+=n.text(b);break}default:{const _='Token with "'+b.type+'" type was not found.';if(this.options.silent)return console.error(_),"";throw new Error(_)}}}return o}},_Hooks=(ar=class{constructor(t){Qt(this,"options");Qt(this,"block");this.options=t||_defaults}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?_Lexer.lex:_Lexer.lexInline}provideParser(){return this.block?_Parser.parse:_Parser.parseInline}},Qt(ar,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),ar),Marked=class{constructor(...t){Qt(this,"defaults",_getDefaults());Qt(this,"options",this.setOptions);Qt(this,"parse",this.parseMarkdown(!0));Qt(this,"parseInline",this.parseMarkdown(!1));Qt(this,"Parser",_Parser);Qt(this,"Renderer",_Renderer);Qt(this,"TextRenderer",_TextRenderer);Qt(this,"Lexer",_Lexer);Qt(this,"Tokenizer",_Tokenizer);Qt(this,"Hooks",_Hooks);this.use(...t)}walkTokens(t,e){var o,l;let n=[];for(const d of t)switch(n=n.concat(e.call(this,d)),d.type){case"table":{const f=d;for(const g of f.header)n=n.concat(this.walkTokens(g.tokens,e));for(const g of f.rows)for(const b of g)n=n.concat(this.walkTokens(b.tokens,e));break}case"list":{const f=d;n=n.concat(this.walkTokens(f.items,e));break}default:{const f=d;(l=(o=this.defaults.extensions)==null?void 0:o.childTokens)!=null&&l[f.type]?this.defaults.extensions.childTokens[f.type].forEach(g=>{const b=f[g].flat(1/0);n=n.concat(this.walkTokens(b,e))}):f.tokens&&(n=n.concat(this.walkTokens(f.tokens,e)))}}return n}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{const o={...n};if(o.async=this.defaults.async||o.async||!1,n.extensions&&(n.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){const d=e.renderers[l.name];d?e.renderers[l.name]=function(...f){let g=l.renderer.apply(this,f);return g===!1&&(g=d.apply(this,f)),g}:e.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 d=e[l.level];d?d.unshift(l.tokenizer):e[l.level]=[l.tokenizer],l.start&&(l.level==="block"?e.startBlock?e.startBlock.push(l.start):e.startBlock=[l.start]:l.level==="inline"&&(e.startInline?e.startInline.push(l.start):e.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(e.childTokens[l.name]=l.childTokens)}),o.extensions=e),n.renderer){const l=this.defaults.renderer||new _Renderer(this.defaults);for(const d in n.renderer){if(!(d in l))throw new Error(`renderer '${d}' does not exist`);if(["options","parser"].includes(d))continue;const f=d,g=n.renderer[f],b=l[f];l[f]=(..._)=>{let S=g.apply(l,_);return S===!1&&(S=b.apply(l,_)),S||""}}o.renderer=l}if(n.tokenizer){const l=this.defaults.tokenizer||new _Tokenizer(this.defaults);for(const d in n.tokenizer){if(!(d in l))throw new Error(`tokenizer '${d}' does not exist`);if(["options","rules","lexer"].includes(d))continue;const f=d,g=n.tokenizer[f],b=l[f];l[f]=(..._)=>{let S=g.apply(l,_);return S===!1&&(S=b.apply(l,_)),S}}o.tokenizer=l}if(n.hooks){const l=this.defaults.hooks||new _Hooks;for(const d in n.hooks){if(!(d in l))throw new Error(`hook '${d}' does not exist`);if(["options","block"].includes(d))continue;const f=d,g=n.hooks[f],b=l[f];_Hooks.passThroughHooks.has(d)?l[f]=_=>{if(this.defaults.async)return Promise.resolve(g.call(l,_)).then(R=>b.call(l,R));const S=g.call(l,_);return b.call(l,S)}:l[f]=(..._)=>{let S=g.apply(l,_);return S===!1&&(S=b.apply(l,_)),S}}o.hooks=l}if(n.walkTokens){const l=this.defaults.walkTokens,d=n.walkTokens;o.walkTokens=function(f){let g=[];return g.push(d.call(this,f)),l&&(g=g.concat(l.call(this,f))),g}}this.defaults={...this.defaults,...o}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return _Lexer.lex(t,e??this.defaults)}parser(t,e){return _Parser.parse(t,e??this.defaults)}parseMarkdown(t){return(n,o)=>{const l={...o},d={...this.defaults,...l},f=this.onError(!!d.silent,!!d.async);if(this.defaults.async===!0&&l.async===!1)return f(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 n>"u"||n===null)return f(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return f(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));d.hooks&&(d.hooks.options=d,d.hooks.block=t);const g=d.hooks?d.hooks.provideLexer():t?_Lexer.lex:_Lexer.lexInline,b=d.hooks?d.hooks.provideParser():t?_Parser.parse:_Parser.parseInline;if(d.async)return Promise.resolve(d.hooks?d.hooks.preprocess(n):n).then(_=>g(_,d)).then(_=>d.hooks?d.hooks.processAllTokens(_):_).then(_=>d.walkTokens?Promise.all(this.walkTokens(_,d.walkTokens)).then(()=>_):_).then(_=>b(_,d)).then(_=>d.hooks?d.hooks.postprocess(_):_).catch(f);try{d.hooks&&(n=d.hooks.preprocess(n));let _=g(n,d);d.hooks&&(_=d.hooks.processAllTokens(_)),d.walkTokens&&this.walkTokens(_,d.walkTokens);let S=b(_,d);return d.hooks&&(S=d.hooks.postprocess(S)),S}catch(_){return f(_)}}}onError(t,e){return n=>{if(n.message+=`
1057
1057
  Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An error occurred:</p><pre>"+escape2(n.message+"",!0)+"</pre>";return e?Promise.resolve(o):o}if(e)return Promise.reject(n);throw n}}},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;/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries,setPrototypeOf,isFrozen,getPrototypeOf,getOwnPropertyDescriptor}=Object;let{freeze,seal,create}=Object,{apply:apply$1,construct}=typeof Reflect<"u"&&Reflect;freeze||(freeze=function(e){return e}),seal||(seal=function(e){return e}),apply$1||(apply$1=function(e,n,o){return e.apply(n,o)}),construct||(construct=function(e,n){return new e(...n)});const arrayForEach=unapply(Array.prototype.forEach),arrayLastIndexOf=unapply(Array.prototype.lastIndexOf),arrayPop=unapply(Array.prototype.pop),arrayPush=unapply(Array.prototype.push),arraySplice=unapply(Array.prototype.splice),stringToLowerCase=unapply(String.prototype.toLowerCase),stringToString=unapply(String.prototype.toString),stringMatch=unapply(String.prototype.match),stringReplace=unapply(String.prototype.replace),stringIndexOf=unapply(String.prototype.indexOf),stringTrim=unapply(String.prototype.trim),objectHasOwnProperty=unapply(Object.prototype.hasOwnProperty),regExpTest=unapply(RegExp.prototype.test),typeErrorCreate=unconstruct(TypeError);function unapply(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,o=new Array(n>1?n-1:0),l=1;l<n;l++)o[l-1]=arguments[l];return apply$1(t,e,o)}}function unconstruct(t){return function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return construct(t,n)}}function addToSet(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:stringToLowerCase;setPrototypeOf&&setPrototypeOf(t,null);let o=e.length;for(;o--;){let l=e[o];if(typeof l=="string"){const d=n(l);d!==l&&(isFrozen(e)||(e[o]=d),l=d)}t[l]=!0}return t}function cleanArray(t){for(let e=0;e<t.length;e++)objectHasOwnProperty(t,e)||(t[e]=null);return t}function clone(t){const e=create(null);for(const[n,o]of entries(t))objectHasOwnProperty(t,n)&&(Array.isArray(o)?e[n]=cleanArray(o):o&&typeof o=="object"&&o.constructor===Object?e[n]=clone(o):e[n]=o);return e}function lookupGetter(t,e){for(;t!==null;){const o=getOwnPropertyDescriptor(t,e);if(o){if(o.get)return unapply(o.get);if(typeof o.value=="function")return unapply(o.value)}t=getPrototypeOf(t)}function n(){return null}return n}const html$1=freeze(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),svg$1=freeze(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),svgFilters=freeze(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),svgDisallowed=freeze(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),mathMl$1=freeze(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),mathMlDisallowed=freeze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),text$1=freeze(["#text"]),html=freeze(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),svg=freeze(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),mathMl=freeze(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),xml=freeze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),MUSTACHE_EXPR=seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ERB_EXPR=seal(/<%[\w\W]*|[\w\W]*%>/gm),TMPLIT_EXPR=seal(/\$\{[\w\W]*/gm),DATA_ATTR=seal(/^data-[\-\w.\u00B7-\uFFFF]+$/),ARIA_ATTR=seal(/^aria-[\-\w]+$/),IS_ALLOWED_URI=seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),IS_SCRIPT_OR_DATA=seal(/^(?:\w+script|data):/i),ATTR_WHITESPACE=seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),DOCTYPE_NAME=seal(/^html$/i),CUSTOM_ELEMENT=seal(/^[a-z][.\w]*(-[.\w]+)+$/i);var EXPRESSIONS=Object.freeze({__proto__:null,ARIA_ATTR,ATTR_WHITESPACE,CUSTOM_ELEMENT,DATA_ATTR,DOCTYPE_NAME,ERB_EXPR,IS_ALLOWED_URI,IS_SCRIPT_OR_DATA,MUSTACHE_EXPR,TMPLIT_EXPR});const NODE_TYPE={element:1,text:3,progressingInstruction:7,comment:8,document:9},getGlobal=function t(){return typeof window>"u"?null:window},_createTrustedTypesPolicy=function t(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let o=null;const l="data-tt-policy-suffix";n&&n.hasAttribute(l)&&(o=n.getAttribute(l));const d="dompurify"+(o?"#"+o:"");try{return e.createPolicy(d,{createHTML(f){return f},createScriptURL(f){return f}})}catch{return console.warn("TrustedTypes policy "+d+" could not be created."),null}},_createHooksMap=function t(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function createDOMPurify(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:getGlobal();const e=Wt=>createDOMPurify(Wt);if(e.version="3.2.6",e.removed=[],!t||!t.document||t.document.nodeType!==NODE_TYPE.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const o=n,l=o.currentScript,{DocumentFragment:d,HTMLTemplateElement:f,Node:g,Element:b,NodeFilter:_,NamedNodeMap:S=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:R,DOMParser:C,trustedTypes:E}=t,A=b.prototype,M=lookupGetter(A,"cloneNode"),I=lookupGetter(A,"remove"),j=lookupGetter(A,"nextSibling"),q=lookupGetter(A,"childNodes"),z=lookupGetter(A,"parentNode");if(typeof f=="function"){const Wt=n.createElement("template");Wt.content&&Wt.content.ownerDocument&&(n=Wt.content.ownerDocument)}let Q,F="";const{implementation:V,createNodeIterator:te,createDocumentFragment:ne,getElementsByTagName:se}=n,{importNode:ge}=o;let oe=_createHooksMap();e.isSupported=typeof entries=="function"&&typeof z=="function"&&V&&V.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ae,ERB_EXPR:je,TMPLIT_EXPR:Ne,DATA_ATTR:Oe,ARIA_ATTR:Fe,IS_SCRIPT_OR_DATA:ze,ATTR_WHITESPACE:$e,CUSTOM_ELEMENT:Be}=EXPRESSIONS;let{IS_ALLOWED_URI:qe}=EXPRESSIONS,Ge=null;const He=addToSet({},[...html$1,...svg$1,...svgFilters,...mathMl$1,...text$1]);let Ze=null;const tt=addToSet({},[...html,...svg,...mathMl,...xml]);let Ye=Object.seal(create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Qe=null,Xe=null,st=!0,rt=!0,at=!1,ot=!0,Ue=!1,Ct=!0,Je=!1,yt=!1,Mt=!1,qt=!1,Ht=!1,Ft=!1,Ke=!0,it=!1;const et="user-content-";let ct=!0,ft=!1,dt={},Rt=null;const zt=addToSet({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Yt=null;const sr=addToSet({},["audio","video","img","source","image","track"]);let dr=null;const mt=addToSet({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Sr="http://www.w3.org/1998/Math/MathML",pt="http://www.w3.org/2000/svg",Zt="http://www.w3.org/1999/xhtml";let Kt=Zt,ur=!1,or=null;const Rr=addToSet({},[Sr,pt,Zt],stringToString);let Er=addToSet({},["mi","mo","mn","ms","mtext"]),gr=addToSet({},["annotation-xml"]);const xr=addToSet({},["title","style","font","a","script"]);let tr=null;const $r=["application/xhtml+xml","text/html"],Xt="text/html";let mr=null,jr=null;const gn=n.createElement("form"),Lr=function(nt){return nt instanceof RegExp||nt instanceof Function},Ar=function(){let nt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(jr&&jr===nt)){if((!nt||typeof nt!="object")&&(nt={}),nt=clone(nt),tr=$r.indexOf(nt.PARSER_MEDIA_TYPE)===-1?Xt:nt.PARSER_MEDIA_TYPE,mr=tr==="application/xhtml+xml"?stringToString:stringToLowerCase,Ge=objectHasOwnProperty(nt,"ALLOWED_TAGS")?addToSet({},nt.ALLOWED_TAGS,mr):He,Ze=objectHasOwnProperty(nt,"ALLOWED_ATTR")?addToSet({},nt.ALLOWED_ATTR,mr):tt,or=objectHasOwnProperty(nt,"ALLOWED_NAMESPACES")?addToSet({},nt.ALLOWED_NAMESPACES,stringToString):Rr,dr=objectHasOwnProperty(nt,"ADD_URI_SAFE_ATTR")?addToSet(clone(mt),nt.ADD_URI_SAFE_ATTR,mr):mt,Yt=objectHasOwnProperty(nt,"ADD_DATA_URI_TAGS")?addToSet(clone(sr),nt.ADD_DATA_URI_TAGS,mr):sr,Rt=objectHasOwnProperty(nt,"FORBID_CONTENTS")?addToSet({},nt.FORBID_CONTENTS,mr):zt,Qe=objectHasOwnProperty(nt,"FORBID_TAGS")?addToSet({},nt.FORBID_TAGS,mr):clone({}),Xe=objectHasOwnProperty(nt,"FORBID_ATTR")?addToSet({},nt.FORBID_ATTR,mr):clone({}),dt=objectHasOwnProperty(nt,"USE_PROFILES")?nt.USE_PROFILES:!1,st=nt.ALLOW_ARIA_ATTR!==!1,rt=nt.ALLOW_DATA_ATTR!==!1,at=nt.ALLOW_UNKNOWN_PROTOCOLS||!1,ot=nt.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ue=nt.SAFE_FOR_TEMPLATES||!1,Ct=nt.SAFE_FOR_XML!==!1,Je=nt.WHOLE_DOCUMENT||!1,qt=nt.RETURN_DOM||!1,Ht=nt.RETURN_DOM_FRAGMENT||!1,Ft=nt.RETURN_TRUSTED_TYPE||!1,Mt=nt.FORCE_BODY||!1,Ke=nt.SANITIZE_DOM!==!1,it=nt.SANITIZE_NAMED_PROPS||!1,ct=nt.KEEP_CONTENT!==!1,ft=nt.IN_PLACE||!1,qe=nt.ALLOWED_URI_REGEXP||IS_ALLOWED_URI,Kt=nt.NAMESPACE||Zt,Er=nt.MATHML_TEXT_INTEGRATION_POINTS||Er,gr=nt.HTML_INTEGRATION_POINTS||gr,Ye=nt.CUSTOM_ELEMENT_HANDLING||{},nt.CUSTOM_ELEMENT_HANDLING&&Lr(nt.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ye.tagNameCheck=nt.CUSTOM_ELEMENT_HANDLING.tagNameCheck),nt.CUSTOM_ELEMENT_HANDLING&&Lr(nt.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ye.attributeNameCheck=nt.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),nt.CUSTOM_ELEMENT_HANDLING&&typeof nt.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Ye.allowCustomizedBuiltInElements=nt.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ue&&(rt=!1),Ht&&(qt=!0),dt&&(Ge=addToSet({},text$1),Ze=[],dt.html===!0&&(addToSet(Ge,html$1),addToSet(Ze,html)),dt.svg===!0&&(addToSet(Ge,svg$1),addToSet(Ze,svg),addToSet(Ze,xml)),dt.svgFilters===!0&&(addToSet(Ge,svgFilters),addToSet(Ze,svg),addToSet(Ze,xml)),dt.mathMl===!0&&(addToSet(Ge,mathMl$1),addToSet(Ze,mathMl),addToSet(Ze,xml))),nt.ADD_TAGS&&(Ge===He&&(Ge=clone(Ge)),addToSet(Ge,nt.ADD_TAGS,mr)),nt.ADD_ATTR&&(Ze===tt&&(Ze=clone(Ze)),addToSet(Ze,nt.ADD_ATTR,mr)),nt.ADD_URI_SAFE_ATTR&&addToSet(dr,nt.ADD_URI_SAFE_ATTR,mr),nt.FORBID_CONTENTS&&(Rt===zt&&(Rt=clone(Rt)),addToSet(Rt,nt.FORBID_CONTENTS,mr)),ct&&(Ge["#text"]=!0),Je&&addToSet(Ge,["html","head","body"]),Ge.table&&(addToSet(Ge,["tbody"]),delete Qe.tbody),nt.TRUSTED_TYPES_POLICY){if(typeof nt.TRUSTED_TYPES_POLICY.createHTML!="function")throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof nt.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');Q=nt.TRUSTED_TYPES_POLICY,F=Q.createHTML("")}else Q===void 0&&(Q=_createTrustedTypesPolicy(E,l)),Q!==null&&typeof F=="string"&&(F=Q.createHTML(""));freeze&&freeze(nt),jr=nt}},sn=addToSet({},[...svg$1,...svgFilters,...svgDisallowed]),Dr=addToSet({},[...mathMl$1,...mathMlDisallowed]),Fr=function(nt){let It=z(nt);(!It||!It.tagName)&&(It={namespaceURI:Kt,tagName:"template"});const Ut=stringToLowerCase(nt.tagName),cr=stringToLowerCase(It.tagName);return or[nt.namespaceURI]?nt.namespaceURI===pt?It.namespaceURI===Zt?Ut==="svg":It.namespaceURI===Sr?Ut==="svg"&&(cr==="annotation-xml"||Er[cr]):!!sn[Ut]:nt.namespaceURI===Sr?It.namespaceURI===Zt?Ut==="math":It.namespaceURI===pt?Ut==="math"&&gr[cr]:!!Dr[Ut]:nt.namespaceURI===Zt?It.namespaceURI===pt&&!gr[cr]||It.namespaceURI===Sr&&!Er[cr]?!1:!Dr[Ut]&&(xr[Ut]||!sn[Ut]):!!(tr==="application/xhtml+xml"&&or[nt.namespaceURI]):!1},Pr=function(nt){arrayPush(e.removed,{element:nt});try{z(nt).removeChild(nt)}catch{I(nt)}},Or=function(nt,It){try{arrayPush(e.removed,{attribute:It.getAttributeNode(nt),from:It})}catch{arrayPush(e.removed,{attribute:null,from:It})}if(It.removeAttribute(nt),nt==="is")if(qt||Ht)try{Pr(It)}catch{}else try{It.setAttribute(nt,"")}catch{}},Xr=function(nt){let It=null,Ut=null;if(Mt)nt="<remove></remove>"+nt;else{const pr=stringMatch(nt,/^[\r\n\t ]+/);Ut=pr&&pr[0]}tr==="application/xhtml+xml"&&Kt===Zt&&(nt='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+nt+"</body></html>");const cr=Q?Q.createHTML(nt):nt;if(Kt===Zt)try{It=new C().parseFromString(cr,tr)}catch{}if(!It||!It.documentElement){It=V.createDocument(Kt,"template",null);try{It.documentElement.innerHTML=ur?F:cr}catch{}}const vr=It.body||It.documentElement;return nt&&Ut&&vr.insertBefore(n.createTextNode(Ut),vr.childNodes[0]||null),Kt===Zt?se.call(It,Je?"html":"body")[0]:Je?It.documentElement:vr},Jr=function(nt){return te.call(nt.ownerDocument||nt,nt,_.SHOW_ELEMENT|_.SHOW_COMMENT|_.SHOW_TEXT|_.SHOW_PROCESSING_INSTRUCTION|_.SHOW_CDATA_SECTION,null)},Gr=function(nt){return nt instanceof R&&(typeof nt.nodeName!="string"||typeof nt.textContent!="string"||typeof nt.removeChild!="function"||!(nt.attributes instanceof S)||typeof nt.removeAttribute!="function"||typeof nt.setAttribute!="function"||typeof nt.namespaceURI!="string"||typeof nt.insertBefore!="function"||typeof nt.hasChildNodes!="function")},Qr=function(nt){return typeof g=="function"&&nt instanceof g};function Nr(Wt,nt,It){arrayForEach(Wt,Ut=>{Ut.call(e,nt,It,jr)})}const on=function(nt){let It=null;if(Nr(oe.beforeSanitizeElements,nt,null),Gr(nt))return Pr(nt),!0;const Ut=mr(nt.nodeName);if(Nr(oe.uponSanitizeElement,nt,{tagName:Ut,allowedTags:Ge}),Ct&&nt.hasChildNodes()&&!Qr(nt.firstElementChild)&&regExpTest(/<[/\w!]/g,nt.innerHTML)&&regExpTest(/<[/\w!]/g,nt.textContent)||nt.nodeType===NODE_TYPE.progressingInstruction||Ct&&nt.nodeType===NODE_TYPE.comment&&regExpTest(/<[/\w]/g,nt.data))return Pr(nt),!0;if(!Ge[Ut]||Qe[Ut]){if(!Qe[Ut]&&dn(Ut)&&(Ye.tagNameCheck instanceof RegExp&&regExpTest(Ye.tagNameCheck,Ut)||Ye.tagNameCheck instanceof Function&&Ye.tagNameCheck(Ut)))return!1;if(ct&&!Rt[Ut]){const cr=z(nt)||nt.parentNode,vr=q(nt)||nt.childNodes;if(vr&&cr){const pr=vr.length;for(let _r=pr-1;_r>=0;--_r){const Cr=M(vr[_r],!0);Cr.__removalCount=(nt.__removalCount||0)+1,cr.insertBefore(Cr,j(nt))}}}return Pr(nt),!0}return nt instanceof b&&!Fr(nt)||(Ut==="noscript"||Ut==="noembed"||Ut==="noframes")&&regExpTest(/<\/no(script|embed|frames)/i,nt.innerHTML)?(Pr(nt),!0):(Ue&&nt.nodeType===NODE_TYPE.text&&(It=nt.textContent,arrayForEach([Ae,je,Ne],cr=>{It=stringReplace(It,cr," ")}),nt.textContent!==It&&(arrayPush(e.removed,{element:nt.cloneNode()}),nt.textContent=It)),Nr(oe.afterSanitizeElements,nt,null),!1)},un=function(nt,It,Ut){if(Ke&&(It==="id"||It==="name")&&(Ut in n||Ut in gn))return!1;if(!(rt&&!Xe[It]&&regExpTest(Oe,It))){if(!(st&&regExpTest(Fe,It))){if(!Ze[It]||Xe[It]){if(!(dn(nt)&&(Ye.tagNameCheck instanceof RegExp&&regExpTest(Ye.tagNameCheck,nt)||Ye.tagNameCheck instanceof Function&&Ye.tagNameCheck(nt))&&(Ye.attributeNameCheck instanceof RegExp&&regExpTest(Ye.attributeNameCheck,It)||Ye.attributeNameCheck instanceof Function&&Ye.attributeNameCheck(It))||It==="is"&&Ye.allowCustomizedBuiltInElements&&(Ye.tagNameCheck instanceof RegExp&&regExpTest(Ye.tagNameCheck,Ut)||Ye.tagNameCheck instanceof Function&&Ye.tagNameCheck(Ut))))return!1}else if(!dr[It]){if(!regExpTest(qe,stringReplace(Ut,$e,""))){if(!((It==="src"||It==="xlink:href"||It==="href")&&nt!=="script"&&stringIndexOf(Ut,"data:")===0&&Yt[nt])){if(!(at&&!regExpTest(ze,stringReplace(Ut,$e,"")))){if(Ut)return!1}}}}}}return!0},dn=function(nt){return nt!=="annotation-xml"&&stringMatch(nt,Be)},en=function(nt){Nr(oe.beforeSanitizeAttributes,nt,null);const{attributes:It}=nt;if(!It||Gr(nt))return;const Ut={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ze,forceKeepAttr:void 0};let cr=It.length;for(;cr--;){const vr=It[cr],{name:pr,namespaceURI:_r,value:Cr}=vr,Br=mr(pr),tn=Cr;let Vt=pr==="value"?tn:stringTrim(tn);if(Ut.attrName=Br,Ut.attrValue=Vt,Ut.keepAttr=!0,Ut.forceKeepAttr=void 0,Nr(oe.uponSanitizeAttribute,nt,Ut),Vt=Ut.attrValue,it&&(Br==="id"||Br==="name")&&(Or(pr,nt),Vt=et+Vt),Ct&&regExpTest(/((--!?|])>)|<\/(style|title)/i,Vt)){Or(pr,nt);continue}if(Ut.forceKeepAttr)continue;if(!Ut.keepAttr){Or(pr,nt);continue}if(!ot&&regExpTest(/\/>/i,Vt)){Or(pr,nt);continue}Ue&&arrayForEach([Ae,je,Ne],Tr=>{Vt=stringReplace(Vt,Tr," ")});const qr=mr(nt.nodeName);if(!un(qr,Br,Vt)){Or(pr,nt);continue}if(Q&&typeof E=="object"&&typeof E.getAttributeType=="function"&&!_r)switch(E.getAttributeType(qr,Br)){case"TrustedHTML":{Vt=Q.createHTML(Vt);break}case"TrustedScriptURL":{Vt=Q.createScriptURL(Vt);break}}if(Vt!==tn)try{_r?nt.setAttributeNS(_r,pr,Vt):nt.setAttribute(pr,Vt),Gr(nt)?Pr(nt):arrayPop(e.removed)}catch{Or(pr,nt)}}Nr(oe.afterSanitizeAttributes,nt,null)},fn=function Wt(nt){let It=null;const Ut=Jr(nt);for(Nr(oe.beforeSanitizeShadowDOM,nt,null);It=Ut.nextNode();)Nr(oe.uponSanitizeShadowNode,It,null),on(It),en(It),It.content instanceof d&&Wt(It.content);Nr(oe.afterSanitizeShadowDOM,nt,null)};return e.sanitize=function(Wt){let nt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},It=null,Ut=null,cr=null,vr=null;if(ur=!Wt,ur&&(Wt="<!-->"),typeof Wt!="string"&&!Qr(Wt))if(typeof Wt.toString=="function"){if(Wt=Wt.toString(),typeof Wt!="string")throw typeErrorCreate("dirty is not a string, aborting")}else throw typeErrorCreate("toString is not a function");if(!e.isSupported)return Wt;if(yt||Ar(nt),e.removed=[],typeof Wt=="string"&&(ft=!1),ft){if(Wt.nodeName){const Cr=mr(Wt.nodeName);if(!Ge[Cr]||Qe[Cr])throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place")}}else if(Wt instanceof g)It=Xr("<!---->"),Ut=It.ownerDocument.importNode(Wt,!0),Ut.nodeType===NODE_TYPE.element&&Ut.nodeName==="BODY"||Ut.nodeName==="HTML"?It=Ut:It.appendChild(Ut);else{if(!qt&&!Ue&&!Je&&Wt.indexOf("<")===-1)return Q&&Ft?Q.createHTML(Wt):Wt;if(It=Xr(Wt),!It)return qt?null:Ft?F:""}It&&Mt&&Pr(It.firstChild);const pr=Jr(ft?Wt:It);for(;cr=pr.nextNode();)on(cr),en(cr),cr.content instanceof d&&fn(cr.content);if(ft)return Wt;if(qt){if(Ht)for(vr=ne.call(It.ownerDocument);It.firstChild;)vr.appendChild(It.firstChild);else vr=It;return(Ze.shadowroot||Ze.shadowrootmode)&&(vr=ge.call(o,vr,!0)),vr}let _r=Je?It.outerHTML:It.innerHTML;return Je&&Ge["!doctype"]&&It.ownerDocument&&It.ownerDocument.doctype&&It.ownerDocument.doctype.name&&regExpTest(DOCTYPE_NAME,It.ownerDocument.doctype.name)&&(_r="<!DOCTYPE "+It.ownerDocument.doctype.name+`>
1058
- `+_r),Ue&&arrayForEach([Ae,je,Ne],Cr=>{_r=stringReplace(_r,Cr," ")}),Q&&Ft?Q.createHTML(_r):_r},e.setConfig=function(){let Wt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ar(Wt),yt=!0},e.clearConfig=function(){jr=null,yt=!1},e.isValidAttribute=function(Wt,nt,It){jr||Ar({});const Ut=mr(Wt),cr=mr(nt);return un(Ut,cr,It)},e.addHook=function(Wt,nt){typeof nt=="function"&&arrayPush(oe[Wt],nt)},e.removeHook=function(Wt,nt){if(nt!==void 0){const It=arrayLastIndexOf(oe[Wt],nt);return It===-1?void 0:arraySplice(oe[Wt],It,1)[0]}return arrayPop(oe[Wt])},e.removeHooks=function(Wt){oe[Wt]=[]},e.removeAllHooks=function(){oe=_createHooksMap()},e}var purify=createDOMPurify();function markdownToSafeHTML(t){var e=marked(t,{async:!1});return purify.sanitize(e,{ALLOWED_TAGS:["h1","h2","h3","h4","h5","h6","b","strong","i","em","u","s","sub","sup","mark","code","pre","blockquote","q","ul","ol","li","dl","dt","dd","p","div","span","br","hr","table","thead","tbody","tfoot","tr","th","td"]})}function SkeletonMessage({botStatus:t}){return jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[jsxRuntime.jsx("div",{className:"h-8 w-8 mt-1 rounded-full bg-gray-300 animate-pulse flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsxs("p",{className:"mb-1",children:["Assistant",jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground mt-1 ml-3",children:new Date().toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})})]}),jsxRuntime.jsx("div",{className:"rounded-md p-3 break-words bg-white border rounded-tl-none",children:jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-150"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-300"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:t})]})})]})]})}function ChatMessages({messages:t,currentUserId:e,botStatus:n,isAssistantChat:o}){return jsxRuntime.jsxs("div",{children:[t.map(l=>{const d=l.fromPartnerID===e;return jsxRuntime.jsxs("div",{className:cn("flex items-start gap-2 mt-2 mb-2",d&&"flex-row-reverse"),children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 mt-1",children:jsxRuntime.jsx(AvatarImage,{src:`https://api.dicebear.com/9.x/thumbs/svg?seed=${md5(l.senderName+l.fromPartnerID)}&flip=${d}`})}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsxs("p",{className:"mb-1",children:[l.senderName,jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground mt-1 ml-3",children:(()=>{const f=new Date(l.timestamp);return isToday(f)?f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}):isYesterday(f)?`Yesterday, ${f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`:`${f.toLocaleDateString([],{month:"short",day:"numeric"})} ${f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`})()})]}),jsxRuntime.jsx("div",{className:cn("rounded-md p-3 break-words [&_li]:ml-6 [&_li]:list-disc [&_h1]:text-lg [&_h1]:font-bold [&_h1]:mt-4 [&_h2]:font-bold [&_h2]:mt-4 [&_h3]:mt-4 ",d?"bg-primary text-white rounded-tr-none":"bg-white border rounded-tl-none"),children:parser(markdownToSafeHTML(l.content))})]})]},l.id)}),n!==""&&jsxRuntime.jsx(SkeletonMessage,{botStatus:n}),t.length===0&&!o&&jsxRuntime.jsx("div",{className:"text-center text-muted-foreground py-8",children:"No messages yet"}),t.length===0&&n===""&&o&&jsxRuntime.jsxs("div",{className:"text-center py-8",children:[jsxRuntime.jsx("p",{children:"The Randmar Assistant is ready to help you. Ask anything about products, orders, carts, shipments and tracking numbers."}),jsxRuntime.jsx("p",{children:jsxRuntime.jsx("strong",{children:'Try it now, type "my open orders"!'})})]})]})}var SWITCH_NAME="Switch",[createSwitchContext,createSwitchScope]=createContextScope(SWITCH_NAME),[SwitchProvider,useSwitchContext]=createSwitchContext(SWITCH_NAME),Switch$1=React__namespace.forwardRef((t,e)=>{const{__scopeSwitch:n,name:o,checked:l,defaultChecked:d,required:f,disabled:g,value:b="on",onCheckedChange:_,form:S,...R}=t,[C,E]=React__namespace.useState(null),A=useComposedRefs(e,z=>E(z)),M=React__namespace.useRef(!1),I=C?S||!!C.closest("form"):!0,[j,q]=useControllableState({prop:l,defaultProp:d??!1,onChange:_,caller:SWITCH_NAME});return jsxRuntime.jsxs(SwitchProvider,{scope:n,checked:j,disabled:g,children:[jsxRuntime.jsx(Primitive.button,{type:"button",role:"switch","aria-checked":j,"aria-required":f,"data-state":getState$2(j),"data-disabled":g?"":void 0,disabled:g,value:b,...R,ref:A,onClick:composeEventHandlers(t.onClick,z=>{q(Q=>!Q),I&&(M.current=z.isPropagationStopped(),M.current||z.stopPropagation())})}),I&&jsxRuntime.jsx(SwitchBubbleInput,{control:C,bubbles:!M.current,name:o,value:b,checked:j,required:f,disabled:g,form:S,style:{transform:"translateX(-100%)"}})]})});Switch$1.displayName=SWITCH_NAME;var THUMB_NAME="SwitchThumb",SwitchThumb=React__namespace.forwardRef((t,e)=>{const{__scopeSwitch:n,...o}=t,l=useSwitchContext(THUMB_NAME,n);return jsxRuntime.jsx(Primitive.span,{"data-state":getState$2(l.checked),"data-disabled":l.disabled?"":void 0,...o,ref:e})});SwitchThumb.displayName=THUMB_NAME;var BUBBLE_INPUT_NAME$2="SwitchBubbleInput",SwitchBubbleInput=React__namespace.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:o=!0,...l},d)=>{const f=React__namespace.useRef(null),g=useComposedRefs(f,d),b=usePrevious(n),_=useSize(e);return React__namespace.useEffect(()=>{const S=f.current;if(!S)return;const R=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(R,"checked").set;if(b!==n&&E){const A=new Event("click",{bubbles:o});E.call(S,n),S.dispatchEvent(A)}},[b,n,o]),jsxRuntime.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...l,tabIndex:-1,ref:g,style:{...l.style,..._,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});SwitchBubbleInput.displayName=BUBBLE_INPUT_NAME$2;function getState$2(t){return t?"checked":"unchecked"}var Root$1=Switch$1,Thumb=SwitchThumb;const Switch=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Root$1,{className:cn("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:jsxRuntime.jsx(Thumb,{className:cn("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Switch.displayName=Root$1.displayName;const DebugMessageDisplay=({debugMessages:t})=>{const[e,n]=React.useState({}),o=l=>{n(d=>({...d,[l]:!d[l]}))};return jsxRuntime.jsx("div",{children:t.map((l,d)=>{if(typeof l=="string")return jsxRuntime.jsx("p",{className:"text-slate-600",children:l},d);{const f=e[d];return jsxRuntime.jsxs("div",{className:"cursor-pointer",onClick:()=>o(d),children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("p",{className:"text-slate-600 mr-2",children:l[0]}),jsxRuntime.jsx("span",{className:"text-slate-500 text-xs",children:f?"▲":"▼"})]}),f&&jsxRuntime.jsx("p",{className:"text-slate-400 pl-4",children:l[1]})]},d)}})})},ASSISTANT_ID="RandmarAIChatAssistant",sortChats=(t,e)=>t.unread>0&&e.unread===0?-1:e.unread>0&&t.unread===0?1:t.name.localeCompare(e.name),ChatLayout=React.forwardRef(({userId:t,userName:e,inputRef:n,assistantOnly:o,className:l,initialPrompt:d},f)=>{const{data:g,refetch:b}=useGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationsQuery({routeApplicationId:t},{skip:o===!0}),[_]=usePostV4PartnerByApplicationIdAccountDebugFeedbackMutation(),[S,{isLoading:R}]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),[C,E]=React.useState(!1),A=React.useRef(null),M=React.useRef(!1),[I]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),[j]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationAndConversationIdReadMutation(),[q]=useLazyGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationAndConversationIdMessagesQuery(),{handleSubmitToBot:z,botMessages:Q,clearBotMessages:F,botReady:V,debugMessages:te,botStatus:ne,reset:se}=useAIAssistant({userId:t,smartAndSlow:C});React.useEffect(()=>{const pt={partner1:t,partner2:ASSISTANT_ID,name:"Randmar Assistant",unread:0,pending:!1,messages:[],conversationID:-1};if(o===!0){Be([pt]);return}if(!g)return;(async()=>{const Kt=g.map(async or=>{var Er,gr,xr;const Rr=await q({routeApplicationId:t,conversationId:or.ConversationId});return{partner1:or.Participant1,partner2:or.Participant2,name:((Er=or.Participant)==null?void 0:Er.PublicName)??"missing public name",unread:((gr=Rr.data)==null?void 0:gr.filter(tr=>!tr.Read&&tr.SenderId!=t).length)??0,pending:or.Status!=="Approved",messages:((xr=Rr.data)==null?void 0:xr.map(tr=>({id:"history"+tr.MessageId,fromPartnerID:tr.SenderId,toPartnerID:tr.SenderId==or.Participant1?or.Participant2:or.Participant1,senderName:tr.SenderName??"missing name",timestamp:new Date(tr.SentDate+"Z").getTime(),content:tr.Content??"no content"})))??[],conversationID:or.ConversationId}}),ur=await Promise.all(Kt);ur.sort(sortChats),Be([pt,...ur]),setTimeout(()=>{var or;return(or=Ue.current)==null?void 0:or.focus()},50)})()},[g,o,t]);const[ge,oe]=React.useState("approved"),[Ae,je]=React.useState([t,ASSISTANT_ID]),[Ne,Oe]=React.useState(""),[Fe,ze]=React.useState(null),[$e,Be]=React.useState([]),[qe,Ge]=React.useState(""),[He,Ze]=React.useState(null),tt=React.useRef(null),Ye=React.useRef(null),[Qe,Xe]=React.useState(null),[st,rt]=React.useState([]),[at,ot]=React.useState([]),Ue=n||Ye,Ct=React.useRef(null),{toast:Je}=useToast(),yt=()=>$e.find(pt=>pt.partner1===(Ae==null?void 0:Ae[0])&&pt.partner2===(Ae==null?void 0:Ae[1])),Mt=()=>(Ae==null?void 0:Ae[0])===ASSISTANT_ID||(Ae==null?void 0:Ae[1])===ASSISTANT_ID;function qt(){const pt=yt();pt&&(Mt()||j({routeApplicationId:t,conversationId:pt.conversationID}))}React.useEffect(()=>{d&&V&&(M.current||Mt()&&(M.current=!0,Ke(d)))},[d,V,Ae,M]);const Ht=React.useMemo(()=>$e.filter(pt=>{if(pt.partner1===ASSISTANT_ID||pt.partner2===ASSISTANT_ID)return!0;const Kt=pt.name.toLowerCase().includes(qe.toLowerCase());return ge==="approved"?Kt&&!pt.pending:ge==="pending"?Kt&&pt.pending:Kt}),[$e,qe,ge]);React.useEffect(()=>{var pt;Qe!==null&&(Je({title:"File attached",description:"Add your instruction before sending.",variant:"success"}),(pt=Ue.current)==null||pt.focus())},[Qe]),React.useEffect(()=>{Q.length!==0&&(Q.forEach(pt=>{if(!pt||pt.isComponent)return;const Zt={id:pt.timestamp.toString(),fromPartnerID:ASSISTANT_ID,toPartnerID:t,senderName:"Assistant",timestamp:pt.timestamp.getTime(),content:pt.content};Ft(Zt)}),F())},[Q]);const Ft=pt=>ot(Zt=>[...Zt,pt]);React.useEffect(()=>{at.length!=0&&(at.forEach(pt=>{Be(Zt=>Zt.map(Kt=>{let ur=Kt.partner1===pt.fromPartnerID&&Kt.partner2===pt.toPartnerID;if(ur||(ur=Kt.partner1===pt.toPartnerID&&Kt.partner2===pt.fromPartnerID),!ur||Kt.messages.some(Rr=>Rr.id===pt.id))return Kt;let or=1;return(Ae==null?void 0:Ae[0])==Kt.partner1&&Ae[1]==Kt.partner2&&(or=0,qt(),setTimeout(()=>{var Rr;return(Rr=tt.current)==null?void 0:Rr.scrollIntoView({behavior:"smooth"})},50),Kt.pending&&oe("approved")),{...Kt,pending:!1,unread:Kt.unread+or,messages:[...Kt.messages,pt]}}).sort(sortChats))}),ot([]))},[at,ot,Be,je,Ae]),React.useEffect(()=>{if(o===!0)return;const pt=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 pt.on("ReceiveMessage",Ft),pt.start().catch(Zt=>console.error("Error connecting to SignalR hub:",Zt)),Ze(pt),()=>{pt&&pt.stop()}},[t,o]),React.useEffect(()=>{var Zt;if(!Ae)return;const pt=yt();pt&&((Zt=Ue.current)==null||Zt.focus(),pt.unread>0&&(qt(),Be(Kt=>Kt.map(ur=>ur.partner1===Ae[0]&&ur.partner2===Ae[1]?{...ur,unread:0}:ur))),setTimeout(()=>{var Kt;return(Kt=tt.current)==null?void 0:Kt.scrollIntoView({behavior:"smooth"})},50))},[$e,Ae]);const Ke=pt=>{if(!Ae)return;const Zt={id:crypto.randomUUID(),senderName:e,fromPartnerID:t,toPartnerID:Ae[0]===t?Ae[1]:Ae[0],content:pt+(Qe?` (${Qe==null?void 0:Qe.name} attached)`:""),timestamp:Date.now()};Ft(Zt),Zt.toPartnerID==ASSISTANT_ID?(z(Zt.content,Qe??void 0),Qe&&rt(Kt=>[...Kt,Qe.name])):He.invoke("NewMessage",Zt).catch(Kt=>console.error("Error sending message:",Kt)),Oe(""),Xe(null),Ct.current&&(Ct.current.value="")},it=(pt,Zt)=>ze([pt,Zt]);if(React.useEffect(()=>{if(Fe===null)return;const pt=$e.find(Kt=>Kt.conversationID===Fe[0]);if(pt&&(pt.pending&&oe("pending"),je([pt.partner1,pt.partner2]),!(Fe[0]===-1&&!V)&&!(Fe[0]!==-1&&!He))){var Zt=Fe[1];ze(null),Zt&&Ke(Zt)}},[Fe,$e,oe,je,V,He]),React.useImperativeHandle(f,()=>({setActiveChatAndSendMessage:it})),!V)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 et=pt=>{var Kt;if(!Mt())return;const Zt=(Kt=pt.clipboardData)==null?void 0:Kt.items;if(Zt){for(let ur=0;ur<Zt.length;ur++)if(Zt[ur].type.indexOf("image")!==-1){const or=Zt[ur].getAsFile();if(or){Xe(or);return}}}},ct=()=>{!Ne.trim()||!Ae||o!==!0&&!He||Ke(Ne)},ft=pt=>{pt.target.files&&pt.target.files[0]?Xe(pt.target.files[0]):Xe(null)},dt=()=>{var pt;(pt=Ct.current)==null||pt.click()},Rt=()=>{var pt;Xe(null),Je({title:"File removed",description:"No file will be sent to the assistant.",variant:"secondary"}),(pt=Ue.current)==null||pt.focus()},zt=()=>{const Zt={messages:$e.find(Kt=>Kt.partner1===ASSISTANT_ID||Kt.partner2===ASSISTANT_ID),debug:te};_({applicationId:t,emailAddress:e,body:Zt})},Yt=async()=>{A.current&&(A.current.disabled=!0),await I({routeApplicationId:t,partnerId:"2"}),await b()},sr=()=>{Be(pt=>pt.map(Kt=>Kt.partner1!==ASSISTANT_ID&&Kt.partner2!==ASSISTANT_ID?Kt:{...Kt,messages:[]})),rt([]),se()},dr=()=>{Ae&&S({routeApplicationId:t,partnerId:Ae[0]==t?Ae[1]:Ae[0]}).then(()=>{oe("approved")})},mt=yt(),Sr=$e.filter(pt=>pt.pending).length;return jsxRuntime.jsxs("div",{className:cn("flex overflow-hidden",l),children:[o!==!0&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"w-[260px] p-4 pt-3 flex flex-col border-r",children:[jsxRuntime.jsx("div",{className:"p-4 font-semibold border-b",children:"Communications"}),$e.length>1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"p-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(Search,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),jsxRuntime.jsx(Input,{placeholder:"Search chats...",className:"pl-8 h-9",value:qe,onChange:pt=>Ge(pt.target.value)})]})}),jsxRuntime.jsx(Tabs,{value:ge,onValueChange:oe,className:"w-full mb-1",children:jsxRuntime.jsxs(TabsList,{className:"grid grid-cols-6 h-9 mx-2",children:[jsxRuntime.jsx(TabsTrigger,{value:"approved",className:"text-xs col-span-3",children:"Approved"}),jsxRuntime.jsxs(TabsTrigger,{value:"pending",className:"text-xs col-span-3",children:["Pending ",Sr>0&&`(${Sr})`]})]})})]}),jsxRuntime.jsx("div",{className:"mt-1 mb-1",children:$e.findIndex(pt=>pt.partner1==="2"||pt.partner2==="2")<0?jsxRuntime.jsx(Button,{className:"w-full",ref:A,onClick:()=>Yt(),children:"Chat with Randmar"},"b1"):ge==="approved"&&$e.length>=5?null:jsxRuntime.jsx("a",{target:"_blank",href:`https://dashboard.randmar.io/${t}/ExploreManufacturers`,children:jsxRuntime.jsx(Button,{className:"w-full",children:"Explore manufacturers"},"b2")})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1",children:$e.length>0&&jsxRuntime.jsx(ChatList,{userId:t,chats:Ht.filter(pt=>pt.partner1!==ASSISTANT_ID&&pt.partner2!==ASSISTANT_ID),activeChat:mt??null,onSelectChat:je})}),jsxRuntime.jsx(Separator$1,{className:"mt-auto"}),jsxRuntime.jsx("div",{className:"pt-1",children:$e.find(pt=>pt.partner1===ASSISTANT_ID||pt.partner2===ASSISTANT_ID)&&jsxRuntime.jsx(ChatList,{userId:t,chats:Ht.filter(pt=>pt.partner1===ASSISTANT_ID||pt.partner2===ASSISTANT_ID),activeChat:mt??null,onSelectChat:je,assistantStickyMode:!0})})]})}),jsxRuntime.jsx("div",{className:"flex-5 flex flex-col",children:Ae?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:Ae[0]==ASSISTANT_ID||Ae[1]==ASSISTANT_ID?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:jsxRuntime.jsx(Bot,{className:"text-primary fill-white min-h-full"})}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:"Randmar Assistant"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 ml-auto",children:[jsxRuntime.jsx(Switch,{id:"smartSwitch",disabled:!!ne,checked:C,onCheckedChange:pt=>{sr(),setTimeout(()=>E(pt),20)}}),jsxRuntime.jsx(Label$2,{htmlFor:"smartSwitch",children:"Think harder"})]}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-1",onClick:()=>sr(),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:()=>zt()},children:jsxRuntime.jsx(MessageSquareShare,{className:"h-5 w-5"})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:jsxRuntime.jsx(PartnerLogo,{id:Ae[0]===t?Ae[1]:Ae[0],width:72,height:72})}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:mt==null?void 0:mt.name}),jsxRuntime.jsx("div",{className:"flex items-center space-x-2 ml-auto",children:jsxRuntime.jsx("a",{href:`https://dashboard.randmar.io/${t}/Partner/${Ae[0]===t?Ae[1]:Ae[0]}`,target:"_blank",children:jsxRuntime.jsx(Button,{children:"View Partner"})})})]})}),mt!=null&&mt.pending&&mt.partner1==t?jsxRuntime.jsx("p",{className:"mt-8 p-2 mx-auto",children:"This conversation is awaiting approval by the other party — please check back later."}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:[jsxRuntime.jsx(ChatMessages,{messages:(mt==null?void 0:mt.messages)??[],currentUserId:t,isAssistantChat:Mt(),botStatus:Mt()?ne:""}),jsxRuntime.jsx("div",{ref:tt})]}),jsxRuntime.jsxs("div",{className:"p-4 border-t border-r flex",children:[(mt==null?void 0:mt.pending)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{disabled:R,onClick:()=>dr(),children:[jsxRuntime.jsx(Handshake,{}),"Accept Conversation Request"]}),jsxRuntime.jsxs(Button,{disabled:!0,className:"ml-2",children:[jsxRuntime.jsx(ThumbsDown,{}),"Block Partner"]})]}),jsxRuntime.jsx(Textarea,{ref:Ue,placeholder:"Type a message...",value:Ne,onPaste:et,onChange:pt=>Oe(pt.target.value),onKeyDown:pt=>{pt.key!=="Enter"||pt.shiftKey||(pt.preventDefault(),ct())},className:mt!=null&&mt.pending?"collapse":"flex-1 resize-none"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Button,{size:"icon",variant:"default",className:mt!=null&&mt.pending?"collapse":"ml-2 h-8 w-8",disabled:!!ne||(mt==null?void 0:mt.pending),onClick:ct,children:jsxRuntime.jsx(Send,{className:"h-6 w-6"})}),Mt()&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Input,{type:"file",onChange:ft,className:"hidden",ref:Ct}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:dt,className:mt!=null&&mt.pending?"collapse":"ml-2 h-8 w-8",disabled:ne!==""||(mt==null?void 0:mt.pending)||!!Qe,children:jsxRuntime.jsx(Paperclip,{className:"h-5 w-5"})}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:Rt,className:mt!=null&&mt.pending?"collapse":"ml-2 h-8 w-8",disabled:ne!==""||(mt==null?void 0:mt.pending)||!Qe,children:jsxRuntime.jsx(Trash,{className:"h-5 w-5"})})]})]})]})]})]}):jsxRuntime.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Select a chat to start messaging"})}),jsxRuntime.jsx("div",{"data-thin":Mt(),className:"w-[480px] flex flex-col border-l flex-4 data-[thin=true]:flex-2",children:Mt()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Sources and System Info"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[Qe?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx(File,{})," ",Qe.name," (pending send...)"]})}):st.length?jsxRuntime.jsx(jsxRuntime.Fragment,{}):jsxRuntime.jsx("p",{children:"No files attached to this conversation yet."}),st.slice().reverse().map(pt=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx(File,{})," ",pt]})}))]})}),jsxRuntime.jsx(ScrollArea,{className:"flex-4 border-t pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx("div",{className:"space-y-2",children:jsxRuntime.jsx(DebugMessageDisplay,{debugMessages:te})})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Partner Overview"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx("div",{className:"mt-1",children:jsxRuntime.jsx(PartnerRelationshipPage,{applicationId:t,partnerId:((Ae==null?void 0:Ae[0])===t?Ae[1]:Ae==null?void 0:Ae[0])??t,userEmail:e,shopifyHostName:void 0,isSuperAdmin:!1})})})]})})]})});function UnsavedChangesDialog({isOpen:t,onClose:e,onConfirm:n,title:o,description:l,confirmText:d="Confirm",cancelText:f="Cancel"}){return jsxRuntime.jsx(Dialog,{open:t,onOpenChange:e,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:o}),jsxRuntime.jsx(DialogDescription,{children:l})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:e,children:f}),jsxRuntime.jsx(Button,{onClick:n,children:d})]})]})})}function useRouterNavigationGuard(t){const[e,n]=React.useState(!1),o=reactRouterDom.useBlocker(React.useCallback(({currentLocation:g,nextLocation:b})=>{const _=g.pathname!==b.pathname||g.search!==b.search||g.hash!==b.hash;return t()&&_},[t]));React.useEffect(()=>{o.state==="blocked"&&n(!0)},[o]),React.useEffect(()=>{const g=b=>{if(t())return b.preventDefault(),"You have unsaved changes. Are you sure you want to leave?"};return window.addEventListener("beforeunload",g),()=>{window.removeEventListener("beforeunload",g)}},[t]);const l=React.useCallback(()=>{n(!1),o.state==="blocked"&&o.proceed()},[o]),d=React.useCallback(()=>{n(!1),o.state==="blocked"&&o.reset()},[o]),f=React.useCallback(()=>jsxRuntime.jsx(UnsavedChangesDialog,{isOpen:e,onClose:d,onConfirm:l,title:"Unsaved Changes",description:"You have unsaved changes. Are you sure you want to leave? Your changes will be lost.",confirmText:"Discard Changes",cancelText:"Stay on Page"}),[e,d,l]);return{showDialog:e,handleConfirm:l,handleCancel:d,NavigationGuardDialog:f}}var isCheckBoxInput=t=>t.type==="checkbox",isDateObject=t=>t instanceof Date,isNullOrUndefined=t=>t==null;const isObjectType=t=>typeof t=="object";var isObject=t=>!isNullOrUndefined(t)&&!Array.isArray(t)&&isObjectType(t)&&!isDateObject(t),getEventValue=t=>isObject(t)&&t.target?isCheckBoxInput(t.target)?t.target.checked:t.target.value:t,getNodeParentName=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,isNameInFieldArray=(t,e)=>t.has(getNodeParentName(e)),isPlainObject$1=t=>{const e=t.constructor&&t.constructor.prototype;return isObject(e)&&e.hasOwnProperty("isPrototypeOf")},isWeb=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function cloneObject(t){let e;const n=Array.isArray(t),o=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(isWeb&&(t instanceof Blob||o))&&(n||isObject(t)))if(e=n?[]:{},!n&&!isPlainObject$1(t))e=t;else for(const l in t)t.hasOwnProperty(l)&&(e[l]=cloneObject(t[l]));else return t;return e}var compact=t=>Array.isArray(t)?t.filter(Boolean):[],isUndefined=t=>t===void 0,get=(t,e,n)=>{if(!e||!isObject(t))return n;const o=compact(e.split(/[,[\].]+?/)).reduce((l,d)=>isNullOrUndefined(l)?l:l[d],t);return isUndefined(o)||o===t?isUndefined(t[e])?n:t[e]:o},isBoolean=t=>typeof t=="boolean",isKey=t=>/^\w*$/.test(t),stringToPath=t=>compact(t.replace(/["|']|\]/g,"").split(/\.|\[/)),set=(t,e,n)=>{let o=-1;const l=isKey(e)?[e]:stringToPath(e),d=l.length,f=d-1;for(;++o<d;){const g=l[o];let b=n;if(o!==f){const _=t[g];b=isObject(_)||Array.isArray(_)?_:isNaN(+l[o+1])?{}:[]}if(g==="__proto__"||g==="constructor"||g==="prototype")return;t[g]=b,t=t[g]}};const EVENTS={BLUR:"blur",FOCUS_OUT:"focusout"},VALIDATION_MODE={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},INPUT_VALIDATION_RULES={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};React.createContext(null);var getProxyFormState=(t,e,n,o=!0)=>{const l={defaultValues:e._defaultValues};for(const d in t)Object.defineProperty(l,d,{get:()=>{const f=d;return e._proxyFormState[f]!==VALIDATION_MODE.all&&(e._proxyFormState[f]=!o||VALIDATION_MODE.all),t[f]}});return l};const useIsomorphicLayoutEffect$1=typeof window<"u"?React__namespace.useLayoutEffect:React__namespace.useEffect;var isString=t=>typeof t=="string",generateWatchOutput=(t,e,n,o,l)=>isString(t)?(o&&e.watch.add(t),get(n,t,l)):Array.isArray(t)?t.map(d=>(o&&e.watch.add(d),get(n,d))):(o&&(e.watchAll=!0),n),appendErrors=(t,e,n,o,l)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[o]:l||!0}}:{},convertToArrayPayload=t=>Array.isArray(t)?t:[t],createSubject=()=>{let t=[];return{get observers(){return t},next:l=>{for(const d of t)d.next&&d.next(l)},subscribe:l=>(t.push(l),{unsubscribe:()=>{t=t.filter(d=>d!==l)}}),unsubscribe:()=>{t=[]}}},isPrimitive=t=>isNullOrUndefined(t)||!isObjectType(t);function deepEqual$1(t,e){if(isPrimitive(t)||isPrimitive(e))return t===e;if(isDateObject(t)&&isDateObject(e))return t.getTime()===e.getTime();const n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(const l of n){const d=t[l];if(!o.includes(l))return!1;if(l!=="ref"){const f=e[l];if(isDateObject(d)&&isDateObject(f)||isObject(d)&&isObject(f)||Array.isArray(d)&&Array.isArray(f)?!deepEqual$1(d,f):d!==f)return!1}}return!0}var isEmptyObject$1=t=>isObject(t)&&!Object.keys(t).length,isFileInput=t=>t.type==="file",isFunction$3=t=>typeof t=="function",isHTMLElement=t=>{if(!isWeb)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},isMultipleSelect=t=>t.type==="select-multiple",isRadioInput=t=>t.type==="radio",isRadioOrCheckbox=t=>isRadioInput(t)||isCheckBoxInput(t),live=t=>isHTMLElement(t)&&t.isConnected;function baseGet(t,e){const n=e.slice(0,-1).length;let o=0;for(;o<n;)t=isUndefined(t)?o++:t[e[o++]];return t}function isEmptyArray(t){for(const e in t)if(t.hasOwnProperty(e)&&!isUndefined(t[e]))return!1;return!0}function unset(t,e){const n=Array.isArray(e)?e:isKey(e)?[e]:stringToPath(e),o=n.length===1?t:baseGet(t,n),l=n.length-1,d=n[l];return o&&delete o[d],l!==0&&(isObject(o)&&isEmptyObject$1(o)||Array.isArray(o)&&isEmptyArray(o))&&unset(t,n.slice(0,-1)),t}var objectHasFunction=t=>{for(const e in t)if(isFunction$3(t[e]))return!0;return!1};function markFieldsDirty(t,e={}){const n=Array.isArray(t);if(isObject(t)||n)for(const o in t)Array.isArray(t[o])||isObject(t[o])&&!objectHasFunction(t[o])?(e[o]=Array.isArray(t[o])?[]:{},markFieldsDirty(t[o],e[o])):isNullOrUndefined(t[o])||(e[o]=!0);return e}function getDirtyFieldsFromDefaultValues(t,e,n){const o=Array.isArray(t);if(isObject(t)||o)for(const l in t)Array.isArray(t[l])||isObject(t[l])&&!objectHasFunction(t[l])?isUndefined(e)||isPrimitive(n[l])?n[l]=Array.isArray(t[l])?markFieldsDirty(t[l],[]):{...markFieldsDirty(t[l])}:getDirtyFieldsFromDefaultValues(t[l],isNullOrUndefined(e)?{}:e[l],n[l]):n[l]=!deepEqual$1(t[l],e[l]);return n}var getDirtyFields=(t,e)=>getDirtyFieldsFromDefaultValues(t,e,markFieldsDirty(e));const defaultResult={value:!1,isValid:!1},validResult={value:!0,isValid:!0};var getCheckboxValue=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!isUndefined(t[0].attributes.value)?isUndefined(t[0].value)||t[0].value===""?validResult:{value:t[0].value,isValid:!0}:validResult:defaultResult}return defaultResult},getFieldValueAs=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:o})=>isUndefined(t)?t:e?t===""?NaN:t&&+t:n&&isString(t)?new Date(t):o?o(t):t;const defaultReturn={isValid:!1,value:null};var getRadioValue=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,defaultReturn):defaultReturn;function getFieldValue(t){const e=t.ref;return isFileInput(e)?e.files:isRadioInput(e)?getRadioValue(t.refs).value:isMultipleSelect(e)?[...e.selectedOptions].map(({value:n})=>n):isCheckBoxInput(e)?getCheckboxValue(t.refs).value:getFieldValueAs(isUndefined(e.value)?t.ref.value:e.value,t)}var getResolverOptions=(t,e,n,o)=>{const l={};for(const d of t){const f=get(e,d);f&&set(l,d,f._f)}return{criteriaMode:n,names:[...t],fields:l,shouldUseNativeValidation:o}},isRegex=t=>t instanceof RegExp,getRuleValue=t=>isUndefined(t)?t:isRegex(t)?t.source:isObject(t)?isRegex(t.value)?t.value.source:t.value:t,getValidationModes=t=>({isOnSubmit:!t||t===VALIDATION_MODE.onSubmit,isOnBlur:t===VALIDATION_MODE.onBlur,isOnChange:t===VALIDATION_MODE.onChange,isOnAll:t===VALIDATION_MODE.all,isOnTouch:t===VALIDATION_MODE.onTouched});const ASYNC_FUNCTION="AsyncFunction";var hasPromiseValidation=t=>!!t&&!!t.validate&&!!(isFunction$3(t.validate)&&t.validate.constructor.name===ASYNC_FUNCTION||isObject(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===ASYNC_FUNCTION)),hasValidation=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),isWatched=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(o=>t.startsWith(o)&&/^\.\w+/.test(t.slice(o.length))));const iterateFieldsByAction=(t,e,n,o)=>{for(const l of n||Object.keys(t)){const d=get(t,l);if(d){const{_f:f,...g}=d;if(f){if(f.refs&&f.refs[0]&&e(f.refs[0],l)&&!o)return!0;if(f.ref&&e(f.ref,f.name)&&!o)return!0;if(iterateFieldsByAction(g,e))break}else if(isObject(g)&&iterateFieldsByAction(g,e))break}}};function schemaErrorLookup(t,e,n){const o=get(t,n);if(o||isKey(n))return{error:o,name:n};const l=n.split(".");for(;l.length;){const d=l.join("."),f=get(e,d),g=get(t,d);if(f&&!Array.isArray(f)&&n!==d)return{name:n};if(g&&g.type)return{name:d,error:g};if(g&&g.root&&g.root.type)return{name:`${d}.root`,error:g.root};l.pop()}return{name:n}}var shouldRenderFormState=(t,e,n,o)=>{n(t);const{name:l,...d}=t;return isEmptyObject$1(d)||Object.keys(d).length>=Object.keys(e).length||Object.keys(d).find(f=>e[f]===(!o||VALIDATION_MODE.all))},shouldSubscribeByName=(t,e,n)=>!t||!e||t===e||convertToArrayPayload(t).some(o=>o&&(n?o===e:o.startsWith(e)||e.startsWith(o))),skipValidation=(t,e,n,o,l)=>l.isOnAll?!1:!n&&l.isOnTouch?!(e||t):(n?o.isOnBlur:l.isOnBlur)?!t:(n?o.isOnChange:l.isOnChange)?t:!0,unsetEmptyArray=(t,e)=>!compact(get(t,e)).length&&unset(t,e),updateFieldArrayRootError=(t,e,n)=>{const o=convertToArrayPayload(get(t,n));return set(o,"root",e[n]),set(t,n,o),t},isMessage=t=>isString(t);function getValidateError(t,e,n="validate"){if(isMessage(t)||Array.isArray(t)&&t.every(isMessage)||isBoolean(t)&&!t)return{type:n,message:isMessage(t)?t:"",ref:e}}var getValueAndMessage=t=>isObject(t)&&!isRegex(t)?t:{value:t,message:""},validateField=async(t,e,n,o,l,d)=>{const{ref:f,refs:g,required:b,maxLength:_,minLength:S,min:R,max:C,pattern:E,validate:A,name:M,valueAsNumber:I,mount:j}=t._f,q=get(n,M);if(!j||e.has(M))return{};const z=g?g[0]:f,Q=Ae=>{l&&z.reportValidity&&(z.setCustomValidity(isBoolean(Ae)?"":Ae||""),z.reportValidity())},F={},V=isRadioInput(f),te=isCheckBoxInput(f),ne=V||te,se=(I||isFileInput(f))&&isUndefined(f.value)&&isUndefined(q)||isHTMLElement(f)&&f.value===""||q===""||Array.isArray(q)&&!q.length,ge=appendErrors.bind(null,M,o,F),oe=(Ae,je,Ne,Oe=INPUT_VALIDATION_RULES.maxLength,Fe=INPUT_VALIDATION_RULES.minLength)=>{const ze=Ae?je:Ne;F[M]={type:Ae?Oe:Fe,message:ze,ref:f,...ge(Ae?Oe:Fe,ze)}};if(d?!Array.isArray(q)||!q.length:b&&(!ne&&(se||isNullOrUndefined(q))||isBoolean(q)&&!q||te&&!getCheckboxValue(g).isValid||V&&!getRadioValue(g).isValid)){const{value:Ae,message:je}=isMessage(b)?{value:!!b,message:b}:getValueAndMessage(b);if(Ae&&(F[M]={type:INPUT_VALIDATION_RULES.required,message:je,ref:z,...ge(INPUT_VALIDATION_RULES.required,je)},!o))return Q(je),F}if(!se&&(!isNullOrUndefined(R)||!isNullOrUndefined(C))){let Ae,je;const Ne=getValueAndMessage(C),Oe=getValueAndMessage(R);if(!isNullOrUndefined(q)&&!isNaN(q)){const Fe=f.valueAsNumber||q&&+q;isNullOrUndefined(Ne.value)||(Ae=Fe>Ne.value),isNullOrUndefined(Oe.value)||(je=Fe<Oe.value)}else{const Fe=f.valueAsDate||new Date(q),ze=qe=>new Date(new Date().toDateString()+" "+qe),$e=f.type=="time",Be=f.type=="week";isString(Ne.value)&&q&&(Ae=$e?ze(q)>ze(Ne.value):Be?q>Ne.value:Fe>new Date(Ne.value)),isString(Oe.value)&&q&&(je=$e?ze(q)<ze(Oe.value):Be?q<Oe.value:Fe<new Date(Oe.value))}if((Ae||je)&&(oe(!!Ae,Ne.message,Oe.message,INPUT_VALIDATION_RULES.max,INPUT_VALIDATION_RULES.min),!o))return Q(F[M].message),F}if((_||S)&&!se&&(isString(q)||d&&Array.isArray(q))){const Ae=getValueAndMessage(_),je=getValueAndMessage(S),Ne=!isNullOrUndefined(Ae.value)&&q.length>+Ae.value,Oe=!isNullOrUndefined(je.value)&&q.length<+je.value;if((Ne||Oe)&&(oe(Ne,Ae.message,je.message),!o))return Q(F[M].message),F}if(E&&!se&&isString(q)){const{value:Ae,message:je}=getValueAndMessage(E);if(isRegex(Ae)&&!q.match(Ae)&&(F[M]={type:INPUT_VALIDATION_RULES.pattern,message:je,ref:f,...ge(INPUT_VALIDATION_RULES.pattern,je)},!o))return Q(je),F}if(A){if(isFunction$3(A)){const Ae=await A(q,n),je=getValidateError(Ae,z);if(je&&(F[M]={...je,...ge(INPUT_VALIDATION_RULES.validate,je.message)},!o))return Q(je.message),F}else if(isObject(A)){let Ae={};for(const je in A){if(!isEmptyObject$1(Ae)&&!o)break;const Ne=getValidateError(await A[je](q,n),z,je);Ne&&(Ae={...Ne,...ge(je,Ne.message)},Q(Ne.message),o&&(F[M]=Ae))}if(!isEmptyObject$1(Ae)&&(F[M]={ref:z,...Ae},!o))return F}}return Q(!0),F};const defaultOptions$1={mode:VALIDATION_MODE.onSubmit,reValidateMode:VALIDATION_MODE.onChange,shouldFocusError:!0};function createFormControl(t={}){let e={...defaultOptions$1,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:isFunction$3(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1};const o={};let l=isObject(e.defaultValues)||isObject(e.values)?cloneObject(e.defaultValues||e.values)||{}:{},d=e.shouldUnregister?{}:cloneObject(l),f={action:!1,mount:!1,watch:!1},g={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},b,_=0;const S={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let R={...S};const C={array:createSubject(),state:createSubject()},E=e.criteriaMode===VALIDATION_MODE.all,A=Ke=>it=>{clearTimeout(_),_=setTimeout(Ke,it)},M=async Ke=>{if(!e.disabled&&(S.isValid||R.isValid||Ke)){const it=e.resolver?isEmptyObject$1((await te()).errors):await se(o,!0);it!==n.isValid&&C.state.next({isValid:it})}},I=(Ke,it)=>{!e.disabled&&(S.isValidating||S.validatingFields||R.isValidating||R.validatingFields)&&((Ke||Array.from(g.mount)).forEach(et=>{et&&(it?set(n.validatingFields,et,it):unset(n.validatingFields,et))}),C.state.next({validatingFields:n.validatingFields,isValidating:!isEmptyObject$1(n.validatingFields)}))},j=(Ke,it=[],et,ct,ft=!0,dt=!0)=>{if(ct&&et&&!e.disabled){if(f.action=!0,dt&&Array.isArray(get(o,Ke))){const Rt=et(get(o,Ke),ct.argA,ct.argB);ft&&set(o,Ke,Rt)}if(dt&&Array.isArray(get(n.errors,Ke))){const Rt=et(get(n.errors,Ke),ct.argA,ct.argB);ft&&set(n.errors,Ke,Rt),unsetEmptyArray(n.errors,Ke)}if((S.touchedFields||R.touchedFields)&&dt&&Array.isArray(get(n.touchedFields,Ke))){const Rt=et(get(n.touchedFields,Ke),ct.argA,ct.argB);ft&&set(n.touchedFields,Ke,Rt)}(S.dirtyFields||R.dirtyFields)&&(n.dirtyFields=getDirtyFields(l,d)),C.state.next({name:Ke,isDirty:oe(Ke,it),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else set(d,Ke,it)},q=(Ke,it)=>{set(n.errors,Ke,it),C.state.next({errors:n.errors})},z=Ke=>{n.errors=Ke,C.state.next({errors:n.errors,isValid:!1})},Q=(Ke,it,et,ct)=>{const ft=get(o,Ke);if(ft){const dt=get(d,Ke,isUndefined(et)?get(l,Ke):et);isUndefined(dt)||ct&&ct.defaultChecked||it?set(d,Ke,it?dt:getFieldValue(ft._f)):Ne(Ke,dt),f.mount&&M()}},F=(Ke,it,et,ct,ft)=>{let dt=!1,Rt=!1;const zt={name:Ke};if(!e.disabled){if(!et||ct){(S.isDirty||R.isDirty)&&(Rt=n.isDirty,n.isDirty=zt.isDirty=oe(),dt=Rt!==zt.isDirty);const Yt=deepEqual$1(get(l,Ke),it);Rt=!!get(n.dirtyFields,Ke),Yt?unset(n.dirtyFields,Ke):set(n.dirtyFields,Ke,!0),zt.dirtyFields=n.dirtyFields,dt=dt||(S.dirtyFields||R.dirtyFields)&&Rt!==!Yt}if(et){const Yt=get(n.touchedFields,Ke);Yt||(set(n.touchedFields,Ke,et),zt.touchedFields=n.touchedFields,dt=dt||(S.touchedFields||R.touchedFields)&&Yt!==et)}dt&&ft&&C.state.next(zt)}return dt?zt:{}},V=(Ke,it,et,ct)=>{const ft=get(n.errors,Ke),dt=(S.isValid||R.isValid)&&isBoolean(it)&&n.isValid!==it;if(e.delayError&&et?(b=A(()=>q(Ke,et)),b(e.delayError)):(clearTimeout(_),b=null,et?set(n.errors,Ke,et):unset(n.errors,Ke)),(et?!deepEqual$1(ft,et):ft)||!isEmptyObject$1(ct)||dt){const Rt={...ct,...dt&&isBoolean(it)?{isValid:it}:{},errors:n.errors,name:Ke};n={...n,...Rt},C.state.next(Rt)}},te=async Ke=>{I(Ke,!0);const it=await e.resolver(d,e.context,getResolverOptions(Ke||g.mount,o,e.criteriaMode,e.shouldUseNativeValidation));return I(Ke),it},ne=async Ke=>{const{errors:it}=await te(Ke);if(Ke)for(const et of Ke){const ct=get(it,et);ct?set(n.errors,et,ct):unset(n.errors,et)}else n.errors=it;return it},se=async(Ke,it,et={valid:!0})=>{for(const ct in Ke){const ft=Ke[ct];if(ft){const{_f:dt,...Rt}=ft;if(dt){const zt=g.array.has(dt.name),Yt=ft._f&&hasPromiseValidation(ft._f);Yt&&S.validatingFields&&I([ct],!0);const sr=await validateField(ft,g.disabled,d,E,e.shouldUseNativeValidation&&!it,zt);if(Yt&&S.validatingFields&&I([ct]),sr[dt.name]&&(et.valid=!1,it))break;!it&&(get(sr,dt.name)?zt?updateFieldArrayRootError(n.errors,sr,dt.name):set(n.errors,dt.name,sr[dt.name]):unset(n.errors,dt.name))}!isEmptyObject$1(Rt)&&await se(Rt,it,et)}}return et.valid},ge=()=>{for(const Ke of g.unMount){const it=get(o,Ke);it&&(it._f.refs?it._f.refs.every(et=>!live(et)):!live(it._f.ref))&&Xe(Ke)}g.unMount=new Set},oe=(Ke,it)=>!e.disabled&&(Ke&&it&&set(d,Ke,it),!deepEqual$1(qe(),l)),Ae=(Ke,it,et)=>generateWatchOutput(Ke,g,{...f.mount?d:isUndefined(it)?l:isString(Ke)?{[Ke]:it}:it},et,it),je=Ke=>compact(get(f.mount?d:l,Ke,e.shouldUnregister?get(l,Ke,[]):[])),Ne=(Ke,it,et={})=>{const ct=get(o,Ke);let ft=it;if(ct){const dt=ct._f;dt&&(!dt.disabled&&set(d,Ke,getFieldValueAs(it,dt)),ft=isHTMLElement(dt.ref)&&isNullOrUndefined(it)?"":it,isMultipleSelect(dt.ref)?[...dt.ref.options].forEach(Rt=>Rt.selected=ft.includes(Rt.value)):dt.refs?isCheckBoxInput(dt.ref)?dt.refs.forEach(Rt=>{(!Rt.defaultChecked||!Rt.disabled)&&(Array.isArray(ft)?Rt.checked=!!ft.find(zt=>zt===Rt.value):Rt.checked=ft===Rt.value||!!ft)}):dt.refs.forEach(Rt=>Rt.checked=Rt.value===ft):isFileInput(dt.ref)?dt.ref.value="":(dt.ref.value=ft,dt.ref.type||C.state.next({name:Ke,values:cloneObject(d)})))}(et.shouldDirty||et.shouldTouch)&&F(Ke,ft,et.shouldTouch,et.shouldDirty,!0),et.shouldValidate&&Be(Ke)},Oe=(Ke,it,et)=>{for(const ct in it){if(!it.hasOwnProperty(ct))return;const ft=it[ct],dt=Ke+"."+ct,Rt=get(o,dt);(g.array.has(Ke)||isObject(ft)||Rt&&!Rt._f)&&!isDateObject(ft)?Oe(dt,ft,et):Ne(dt,ft,et)}},Fe=(Ke,it,et={})=>{const ct=get(o,Ke),ft=g.array.has(Ke),dt=cloneObject(it);set(d,Ke,dt),ft?(C.array.next({name:Ke,values:cloneObject(d)}),(S.isDirty||S.dirtyFields||R.isDirty||R.dirtyFields)&&et.shouldDirty&&C.state.next({name:Ke,dirtyFields:getDirtyFields(l,d),isDirty:oe(Ke,dt)})):ct&&!ct._f&&!isNullOrUndefined(dt)?Oe(Ke,dt,et):Ne(Ke,dt,et),isWatched(Ke,g)&&C.state.next({...n}),C.state.next({name:f.mount?Ke:void 0,values:cloneObject(d)})},ze=async Ke=>{f.mount=!0;const it=Ke.target;let et=it.name,ct=!0;const ft=get(o,et),dt=Yt=>{ct=Number.isNaN(Yt)||isDateObject(Yt)&&isNaN(Yt.getTime())||deepEqual$1(Yt,get(d,et,Yt))},Rt=getValidationModes(e.mode),zt=getValidationModes(e.reValidateMode);if(ft){let Yt,sr;const dr=it.type?getFieldValue(ft._f):getEventValue(Ke),mt=Ke.type===EVENTS.BLUR||Ke.type===EVENTS.FOCUS_OUT,Sr=!hasValidation(ft._f)&&!e.resolver&&!get(n.errors,et)&&!ft._f.deps||skipValidation(mt,get(n.touchedFields,et),n.isSubmitted,zt,Rt),pt=isWatched(et,g,mt);set(d,et,dr),mt?(ft._f.onBlur&&ft._f.onBlur(Ke),b&&b(0)):ft._f.onChange&&ft._f.onChange(Ke);const Zt=F(et,dr,mt),Kt=!isEmptyObject$1(Zt)||pt;if(!mt&&C.state.next({name:et,type:Ke.type,values:cloneObject(d)}),Sr)return(S.isValid||R.isValid)&&(e.mode==="onBlur"?mt&&M():mt||M()),Kt&&C.state.next({name:et,...pt?{}:Zt});if(!mt&&pt&&C.state.next({...n}),e.resolver){const{errors:ur}=await te([et]);if(dt(dr),ct){const or=schemaErrorLookup(n.errors,o,et),Rr=schemaErrorLookup(ur,o,or.name||et);Yt=Rr.error,et=Rr.name,sr=isEmptyObject$1(ur)}}else I([et],!0),Yt=(await validateField(ft,g.disabled,d,E,e.shouldUseNativeValidation))[et],I([et]),dt(dr),ct&&(Yt?sr=!1:(S.isValid||R.isValid)&&(sr=await se(o,!0)));ct&&(ft._f.deps&&Be(ft._f.deps),V(et,sr,Yt,Zt))}},$e=(Ke,it)=>{if(get(n.errors,it)&&Ke.focus)return Ke.focus(),1},Be=async(Ke,it={})=>{let et,ct;const ft=convertToArrayPayload(Ke);if(e.resolver){const dt=await ne(isUndefined(Ke)?Ke:ft);et=isEmptyObject$1(dt),ct=Ke?!ft.some(Rt=>get(dt,Rt)):et}else Ke?(ct=(await Promise.all(ft.map(async dt=>{const Rt=get(o,dt);return await se(Rt&&Rt._f?{[dt]:Rt}:Rt)}))).every(Boolean),!(!ct&&!n.isValid)&&M()):ct=et=await se(o);return C.state.next({...!isString(Ke)||(S.isValid||R.isValid)&&et!==n.isValid?{}:{name:Ke},...e.resolver||!Ke?{isValid:et}:{},errors:n.errors}),it.shouldFocus&&!ct&&iterateFieldsByAction(o,$e,Ke?ft:g.mount),ct},qe=Ke=>{const it={...f.mount?d:l};return isUndefined(Ke)?it:isString(Ke)?get(it,Ke):Ke.map(et=>get(it,et))},Ge=(Ke,it)=>({invalid:!!get((it||n).errors,Ke),isDirty:!!get((it||n).dirtyFields,Ke),error:get((it||n).errors,Ke),isValidating:!!get(n.validatingFields,Ke),isTouched:!!get((it||n).touchedFields,Ke)}),He=Ke=>{Ke&&convertToArrayPayload(Ke).forEach(it=>unset(n.errors,it)),C.state.next({errors:Ke?n.errors:{}})},Ze=(Ke,it,et)=>{const ct=(get(o,Ke,{_f:{}})._f||{}).ref,ft=get(n.errors,Ke)||{},{ref:dt,message:Rt,type:zt,...Yt}=ft;set(n.errors,Ke,{...Yt,...it,ref:ct}),C.state.next({name:Ke,errors:n.errors,isValid:!1}),et&&et.shouldFocus&&ct&&ct.focus&&ct.focus()},tt=(Ke,it)=>isFunction$3(Ke)?C.state.subscribe({next:et=>Ke(Ae(void 0,it),et)}):Ae(Ke,it,!0),Ye=Ke=>C.state.subscribe({next:it=>{shouldSubscribeByName(Ke.name,it.name,Ke.exact)&&shouldRenderFormState(it,Ke.formState||S,qt,Ke.reRenderRoot)&&Ke.callback({values:{...d},...n,...it})}}).unsubscribe,Qe=Ke=>(f.mount=!0,R={...R,...Ke.formState},Ye({...Ke,formState:R})),Xe=(Ke,it={})=>{for(const et of Ke?convertToArrayPayload(Ke):g.mount)g.mount.delete(et),g.array.delete(et),it.keepValue||(unset(o,et),unset(d,et)),!it.keepError&&unset(n.errors,et),!it.keepDirty&&unset(n.dirtyFields,et),!it.keepTouched&&unset(n.touchedFields,et),!it.keepIsValidating&&unset(n.validatingFields,et),!e.shouldUnregister&&!it.keepDefaultValue&&unset(l,et);C.state.next({values:cloneObject(d)}),C.state.next({...n,...it.keepDirty?{isDirty:oe()}:{}}),!it.keepIsValid&&M()},st=({disabled:Ke,name:it})=>{(isBoolean(Ke)&&f.mount||Ke||g.disabled.has(it))&&(Ke?g.disabled.add(it):g.disabled.delete(it))},rt=(Ke,it={})=>{let et=get(o,Ke);const ct=isBoolean(it.disabled)||isBoolean(e.disabled);return set(o,Ke,{...et||{},_f:{...et&&et._f?et._f:{ref:{name:Ke}},name:Ke,mount:!0,...it}}),g.mount.add(Ke),et?st({disabled:isBoolean(it.disabled)?it.disabled:e.disabled,name:Ke}):Q(Ke,!0,it.value),{...ct?{disabled:it.disabled||e.disabled}:{},...e.progressive?{required:!!it.required,min:getRuleValue(it.min),max:getRuleValue(it.max),minLength:getRuleValue(it.minLength),maxLength:getRuleValue(it.maxLength),pattern:getRuleValue(it.pattern)}:{},name:Ke,onChange:ze,onBlur:ze,ref:ft=>{if(ft){rt(Ke,it),et=get(o,Ke);const dt=isUndefined(ft.value)&&ft.querySelectorAll&&ft.querySelectorAll("input,select,textarea")[0]||ft,Rt=isRadioOrCheckbox(dt),zt=et._f.refs||[];if(Rt?zt.find(Yt=>Yt===dt):dt===et._f.ref)return;set(o,Ke,{_f:{...et._f,...Rt?{refs:[...zt.filter(live),dt,...Array.isArray(get(l,Ke))?[{}]:[]],ref:{type:dt.type,name:Ke}}:{ref:dt}}}),Q(Ke,!1,void 0,dt)}else et=get(o,Ke,{}),et._f&&(et._f.mount=!1),(e.shouldUnregister||it.shouldUnregister)&&!(isNameInFieldArray(g.array,Ke)&&f.action)&&g.unMount.add(Ke)}}},at=()=>e.shouldFocusError&&iterateFieldsByAction(o,$e,g.mount),ot=Ke=>{isBoolean(Ke)&&(C.state.next({disabled:Ke}),iterateFieldsByAction(o,(it,et)=>{const ct=get(o,et);ct&&(it.disabled=ct._f.disabled||Ke,Array.isArray(ct._f.refs)&&ct._f.refs.forEach(ft=>{ft.disabled=ct._f.disabled||Ke}))},0,!1))},Ue=(Ke,it)=>async et=>{let ct;et&&(et.preventDefault&&et.preventDefault(),et.persist&&et.persist());let ft=cloneObject(d);if(C.state.next({isSubmitting:!0}),e.resolver){const{errors:dt,values:Rt}=await te();n.errors=dt,ft=Rt}else await se(o);if(g.disabled.size)for(const dt of g.disabled)set(ft,dt,void 0);if(unset(n.errors,"root"),isEmptyObject$1(n.errors)){C.state.next({errors:{}});try{await Ke(ft,et)}catch(dt){ct=dt}}else it&&await it({...n.errors},et),at(),setTimeout(at);if(C.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:isEmptyObject$1(n.errors)&&!ct,submitCount:n.submitCount+1,errors:n.errors}),ct)throw ct},Ct=(Ke,it={})=>{get(o,Ke)&&(isUndefined(it.defaultValue)?Fe(Ke,cloneObject(get(l,Ke))):(Fe(Ke,it.defaultValue),set(l,Ke,cloneObject(it.defaultValue))),it.keepTouched||unset(n.touchedFields,Ke),it.keepDirty||(unset(n.dirtyFields,Ke),n.isDirty=it.defaultValue?oe(Ke,cloneObject(get(l,Ke))):oe()),it.keepError||(unset(n.errors,Ke),S.isValid&&M()),C.state.next({...n}))},Je=(Ke,it={})=>{const et=Ke?cloneObject(Ke):l,ct=cloneObject(et),ft=isEmptyObject$1(Ke),dt=ft?l:ct;if(it.keepDefaultValues||(l=et),!it.keepValues){if(it.keepDirtyValues){const Rt=new Set([...g.mount,...Object.keys(getDirtyFields(l,d))]);for(const zt of Array.from(Rt))get(n.dirtyFields,zt)?set(dt,zt,get(d,zt)):Fe(zt,get(dt,zt))}else{if(isWeb&&isUndefined(Ke))for(const Rt of g.mount){const zt=get(o,Rt);if(zt&&zt._f){const Yt=Array.isArray(zt._f.refs)?zt._f.refs[0]:zt._f.ref;if(isHTMLElement(Yt)){const sr=Yt.closest("form");if(sr){sr.reset();break}}}}for(const Rt of g.mount)Fe(Rt,get(dt,Rt))}d=cloneObject(dt),C.array.next({values:{...dt}}),C.state.next({values:{...dt}})}g={mount:it.keepDirtyValues?g.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},f.mount=!S.isValid||!!it.keepIsValid||!!it.keepDirtyValues,f.watch=!!e.shouldUnregister,C.state.next({submitCount:it.keepSubmitCount?n.submitCount:0,isDirty:ft?!1:it.keepDirty?n.isDirty:!!(it.keepDefaultValues&&!deepEqual$1(Ke,l)),isSubmitted:it.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ft?{}:it.keepDirtyValues?it.keepDefaultValues&&d?getDirtyFields(l,d):n.dirtyFields:it.keepDefaultValues&&Ke?getDirtyFields(l,Ke):it.keepDirty?n.dirtyFields:{},touchedFields:it.keepTouched?n.touchedFields:{},errors:it.keepErrors?n.errors:{},isSubmitSuccessful:it.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},yt=(Ke,it)=>Je(isFunction$3(Ke)?Ke(d):Ke,it),Mt=(Ke,it={})=>{const et=get(o,Ke),ct=et&&et._f;if(ct){const ft=ct.refs?ct.refs[0]:ct.ref;ft.focus&&(ft.focus(),it.shouldSelect&&isFunction$3(ft.select)&&ft.select())}},qt=Ke=>{n={...n,...Ke}},Ft={control:{register:rt,unregister:Xe,getFieldState:Ge,handleSubmit:Ue,setError:Ze,_subscribe:Ye,_runSchema:te,_focusError:at,_getWatch:Ae,_getDirty:oe,_setValid:M,_setFieldArray:j,_setDisabledField:st,_setErrors:z,_getFieldArray:je,_reset:Je,_resetDefaultValues:()=>isFunction$3(e.defaultValues)&&e.defaultValues().then(Ke=>{yt(Ke,e.resetOptions),C.state.next({isLoading:!1})}),_removeUnmounted:ge,_disableForm:ot,_subjects:C,_proxyFormState:S,get _fields(){return o},get _formValues(){return d},get _state(){return f},set _state(Ke){f=Ke},get _defaultValues(){return l},get _names(){return g},set _names(Ke){g=Ke},get _formState(){return n},get _options(){return e},set _options(Ke){e={...e,...Ke}}},subscribe:Qe,trigger:Be,register:rt,handleSubmit:Ue,watch:tt,setValue:Fe,getValues:qe,reset:yt,resetField:Ct,clearErrors:He,unregister:Xe,setError:Ze,setFocus:Mt,getFieldState:Ge};return{...Ft,formControl:Ft}}function useForm(t={}){const e=React.useRef(void 0),n=React.useRef(void 0),[o,l]=React.useState({isDirty:!1,isValidating:!1,isLoading:isFunction$3(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:isFunction$3(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...t.formControl?t.formControl:createFormControl(t),formState:o},t.formControl&&t.defaultValues&&!isFunction$3(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions));const d=e.current.control;return d._options=t,useIsomorphicLayoutEffect$1(()=>{const f=d._subscribe({formState:d._proxyFormState,callback:()=>l({...d._formState}),reRenderRoot:!0});return l(g=>({...g,isReady:!0})),d._formState.isReady=!0,f},[d]),React.useEffect(()=>d._disableForm(t.disabled),[d,t.disabled]),React.useEffect(()=>{t.mode&&(d._options.mode=t.mode),t.reValidateMode&&(d._options.reValidateMode=t.reValidateMode)},[d,t.mode,t.reValidateMode]),React.useEffect(()=>{t.errors&&(d._setErrors(t.errors),d._focusError())},[d,t.errors]),React.useEffect(()=>{t.shouldUnregister&&d._subjects.state.next({values:d._getWatch()})},[d,t.shouldUnregister]),React.useEffect(()=>{if(d._proxyFormState.isDirty){const f=d._getDirty();f!==o.isDirty&&d._subjects.state.next({isDirty:f})}},[d,o.isDirty]),React.useEffect(()=>{t.values&&!deepEqual$1(t.values,n.current)?(d._reset(t.values,d._options.resetOptions),n.current=t.values,l(f=>({...f}))):d._resetDefaultValues()},[d,t.values]),React.useEffect(()=>{d._state.mount||(d._setValid(),d._state.mount=!0),d._state.watch&&(d._state.watch=!1,d._subjects.state.next({...d._formState})),d._removeUnmounted()}),e.current.formState=getProxyFormState(o,d),e.current}var defaultErrorHandler=function(t){process.env.NODE_ENV!=="production"&&console.error(t)},defaultWarnHandler=function(t){process.env.NODE_ENV!=="production"&&console.warn(t)},DEFAULT_INTL_CONFIG={formats:{},messages:{},timeZone:void 0,defaultLocale:"en",defaultFormats:{},fallbackOnEmptyString:!0,onError:defaultErrorHandler,onWarn:defaultWarnHandler};function invariant(t,e,n){if(n===void 0&&(n=Error),!t)throw new n(e)}function invariantIntlContext(t){invariant(t,"[React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry.")}__assign$1(__assign$1({},DEFAULT_INTL_CONFIG),{textComponent:React__namespace.Fragment});var reactIs={exports:{}},reactIs_production_min={};/** @license React v16.13.1
1058
+ `+_r),Ue&&arrayForEach([Ae,je,Ne],Cr=>{_r=stringReplace(_r,Cr," ")}),Q&&Ft?Q.createHTML(_r):_r},e.setConfig=function(){let Wt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ar(Wt),yt=!0},e.clearConfig=function(){jr=null,yt=!1},e.isValidAttribute=function(Wt,nt,It){jr||Ar({});const Ut=mr(Wt),cr=mr(nt);return un(Ut,cr,It)},e.addHook=function(Wt,nt){typeof nt=="function"&&arrayPush(oe[Wt],nt)},e.removeHook=function(Wt,nt){if(nt!==void 0){const It=arrayLastIndexOf(oe[Wt],nt);return It===-1?void 0:arraySplice(oe[Wt],It,1)[0]}return arrayPop(oe[Wt])},e.removeHooks=function(Wt){oe[Wt]=[]},e.removeAllHooks=function(){oe=_createHooksMap()},e}var purify=createDOMPurify();function markdownToSafeHTML(t){var e=marked(t,{async:!1});return purify.sanitize(e,{ALLOWED_TAGS:["h1","h2","h3","h4","h5","h6","b","strong","i","em","u","s","sub","sup","mark","code","pre","blockquote","q","ul","ol","li","dl","dt","dd","p","div","span","br","hr","table","thead","tbody","tfoot","tr","th","td"]})}function SkeletonMessage({botStatus:t}){return jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[jsxRuntime.jsx("div",{className:"h-8 w-8 mt-1 rounded-full bg-gray-300 animate-pulse flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsxs("p",{className:"mb-1",children:["Assistant",jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground mt-1 ml-3",children:new Date().toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})})]}),jsxRuntime.jsx("div",{className:"rounded-md p-3 break-words bg-white border rounded-tl-none",children:jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-150"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-300"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:t})]})})]})]})}function ChatMessages({messages:t,currentUserId:e,botStatus:n,isAssistantChat:o}){return jsxRuntime.jsxs("div",{children:[t.map(l=>{const d=l.fromPartnerID===e;return jsxRuntime.jsxs("div",{className:cn("flex items-start gap-2 mt-2 mb-2",d&&"flex-row-reverse"),children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 mt-1",children:jsxRuntime.jsx(AvatarImage,{src:`https://api.dicebear.com/9.x/thumbs/svg?seed=${md5(l.senderName+l.fromPartnerID)}&flip=${d}`})}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsxs("p",{className:"mb-1",children:[l.senderName,jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground mt-1 ml-3",children:(()=>{const f=new Date(l.timestamp);return isToday(f)?f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}):isYesterday(f)?`Yesterday, ${f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`:`${f.toLocaleDateString([],{month:"short",day:"numeric"})} ${f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`})()})]}),jsxRuntime.jsx("div",{className:cn("rounded-md p-3 break-words [&_li]:ml-6 [&_li]:list-disc [&_h1]:text-lg [&_h1]:font-bold [&_h1]:mt-4 [&_h2]:font-bold [&_h2]:mt-4 [&_h3]:mt-4 ",d?"bg-primary text-white rounded-tr-none":"bg-white border rounded-tl-none"),children:parser(markdownToSafeHTML(l.content))})]})]},l.id)}),n!==""&&jsxRuntime.jsx(SkeletonMessage,{botStatus:n}),t.length===0&&!o&&jsxRuntime.jsx("div",{className:"text-center text-muted-foreground py-8",children:"No messages yet"}),t.length===0&&n===""&&o&&jsxRuntime.jsxs("div",{className:"text-center py-8",children:[jsxRuntime.jsx("p",{children:"The Randmar Assistant is ready to help you. Ask anything about products, orders, carts, shipments and tracking numbers."}),jsxRuntime.jsx("p",{children:jsxRuntime.jsx("strong",{children:'Try it now, type "my open orders"!'})})]})]})}var SWITCH_NAME="Switch",[createSwitchContext,createSwitchScope]=createContextScope(SWITCH_NAME),[SwitchProvider,useSwitchContext]=createSwitchContext(SWITCH_NAME),Switch$1=React__namespace.forwardRef((t,e)=>{const{__scopeSwitch:n,name:o,checked:l,defaultChecked:d,required:f,disabled:g,value:b="on",onCheckedChange:_,form:S,...R}=t,[C,E]=React__namespace.useState(null),A=useComposedRefs(e,z=>E(z)),M=React__namespace.useRef(!1),I=C?S||!!C.closest("form"):!0,[j,q]=useControllableState({prop:l,defaultProp:d??!1,onChange:_,caller:SWITCH_NAME});return jsxRuntime.jsxs(SwitchProvider,{scope:n,checked:j,disabled:g,children:[jsxRuntime.jsx(Primitive.button,{type:"button",role:"switch","aria-checked":j,"aria-required":f,"data-state":getState$2(j),"data-disabled":g?"":void 0,disabled:g,value:b,...R,ref:A,onClick:composeEventHandlers(t.onClick,z=>{q(Q=>!Q),I&&(M.current=z.isPropagationStopped(),M.current||z.stopPropagation())})}),I&&jsxRuntime.jsx(SwitchBubbleInput,{control:C,bubbles:!M.current,name:o,value:b,checked:j,required:f,disabled:g,form:S,style:{transform:"translateX(-100%)"}})]})});Switch$1.displayName=SWITCH_NAME;var THUMB_NAME="SwitchThumb",SwitchThumb=React__namespace.forwardRef((t,e)=>{const{__scopeSwitch:n,...o}=t,l=useSwitchContext(THUMB_NAME,n);return jsxRuntime.jsx(Primitive.span,{"data-state":getState$2(l.checked),"data-disabled":l.disabled?"":void 0,...o,ref:e})});SwitchThumb.displayName=THUMB_NAME;var BUBBLE_INPUT_NAME$2="SwitchBubbleInput",SwitchBubbleInput=React__namespace.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:o=!0,...l},d)=>{const f=React__namespace.useRef(null),g=useComposedRefs(f,d),b=usePrevious(n),_=useSize(e);return React__namespace.useEffect(()=>{const S=f.current;if(!S)return;const R=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(R,"checked").set;if(b!==n&&E){const A=new Event("click",{bubbles:o});E.call(S,n),S.dispatchEvent(A)}},[b,n,o]),jsxRuntime.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...l,tabIndex:-1,ref:g,style:{...l.style,..._,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});SwitchBubbleInput.displayName=BUBBLE_INPUT_NAME$2;function getState$2(t){return t?"checked":"unchecked"}var Root$1=Switch$1,Thumb=SwitchThumb;const Switch=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Root$1,{className:cn("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:jsxRuntime.jsx(Thumb,{className:cn("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Switch.displayName=Root$1.displayName;const DebugMessageDisplay=({debugMessages:t})=>{const[e,n]=React.useState({}),o=l=>{n(d=>({...d,[l]:!d[l]}))};return jsxRuntime.jsx("div",{children:t.map((l,d)=>{if(typeof l=="string")return jsxRuntime.jsx("p",{className:"text-slate-600",children:l},d);{const f=e[d];return jsxRuntime.jsxs("div",{className:"cursor-pointer",onClick:()=>o(d),children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("p",{className:"text-slate-600 mr-2",children:l[0]}),jsxRuntime.jsx("span",{className:"text-slate-500 text-xs",children:f?"▲":"▼"})]}),f&&jsxRuntime.jsx("p",{className:"text-slate-400 pl-4",children:l[1]})]},d)}})})},ASSISTANT_ID="RandmarAIChatAssistant",sortChats=(t,e)=>t.unread>0&&e.unread===0?-1:e.unread>0&&t.unread===0?1:t.name.localeCompare(e.name),ChatLayout=React.forwardRef(({userId:t,userName:e,inputRef:n,assistantOnly:o,className:l,initialPrompt:d},f)=>{const{data:g,refetch:b}=useGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationsQuery({routeApplicationId:t},{skip:o===!0}),[_]=usePostV4PartnerByApplicationIdAccountDebugFeedbackMutation(),[S,{isLoading:R}]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),[C,E]=React.useState(!1),A=React.useRef(null),M=React.useRef(!1),[I]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),[j]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationAndConversationIdReadMutation(),[q]=useLazyGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationAndConversationIdMessagesQuery(),{handleSubmitToBot:z,botMessages:Q,clearBotMessages:F,botReady:V,debugMessages:te,botStatus:ne,reset:se}=useAIAssistant({userId:t,smartAndSlow:C});React.useEffect(()=>{const pt={partner1:t,partner2:ASSISTANT_ID,name:"Randmar Assistant",unread:0,pending:!1,messages:[],conversationID:-1};if(o===!0){Be([pt]);return}if(!g)return;(async()=>{const Kt=g.map(async or=>{var Er,gr,xr;const Rr=await q({routeApplicationId:t,conversationId:or.ConversationId});return{partner1:or.Participant1,partner2:or.Participant2,name:((Er=or.Participant)==null?void 0:Er.PublicName)??"missing public name",unread:((gr=Rr.data)==null?void 0:gr.filter(tr=>!tr.Read&&tr.SenderId!=t).length)??0,pending:or.Status!=="Approved",messages:((xr=Rr.data)==null?void 0:xr.map(tr=>({id:"history"+tr.MessageId,fromPartnerID:tr.SenderId,toPartnerID:tr.SenderId==or.Participant1?or.Participant2:or.Participant1,senderName:tr.SenderName??"missing name",timestamp:new Date(tr.SentDate+"Z").getTime(),content:tr.Content??"no content"})))??[],conversationID:or.ConversationId}}),ur=await Promise.all(Kt);ur.sort(sortChats),Be([pt,...ur]),setTimeout(()=>{var or;return(or=Ue.current)==null?void 0:or.focus()},50)})()},[g,o,t]);const[ge,oe]=React.useState("approved"),[Ae,je]=React.useState([t,ASSISTANT_ID]),[Ne,Oe]=React.useState(""),[Fe,ze]=React.useState(null),[$e,Be]=React.useState([]),[qe,Ge]=React.useState(""),[He,Ze]=React.useState(null),tt=React.useRef(null),Ye=React.useRef(null),[Qe,Xe]=React.useState(null),[st,rt]=React.useState([]),[at,ot]=React.useState([]),Ue=n||Ye,Ct=React.useRef(null),{toast:Je}=useToast(),yt=()=>$e.find(pt=>pt.partner1===(Ae==null?void 0:Ae[0])&&pt.partner2===(Ae==null?void 0:Ae[1])),Mt=()=>(Ae==null?void 0:Ae[0])===ASSISTANT_ID||(Ae==null?void 0:Ae[1])===ASSISTANT_ID;function qt(){const pt=yt();pt&&(Mt()||j({routeApplicationId:t,conversationId:pt.conversationID}))}React.useEffect(()=>{d&&V&&(M.current||Mt()&&(M.current=!0,Ke(d)))},[d,V,Ae,M]);const Ht=React.useMemo(()=>$e.filter(pt=>{if(pt.partner1===ASSISTANT_ID||pt.partner2===ASSISTANT_ID)return!0;const Kt=pt.name.toLowerCase().includes(qe.toLowerCase());return ge==="approved"?Kt&&!pt.pending:ge==="pending"?Kt&&pt.pending:Kt}),[$e,qe,ge]);React.useEffect(()=>{var pt;Qe!==null&&(Je({title:"File attached",description:"Add your instruction before sending.",variant:"success"}),(pt=Ue.current)==null||pt.focus())},[Qe]),React.useEffect(()=>{Q.length!==0&&(Q.forEach(pt=>{if(!pt||pt.isComponent)return;const Zt={id:pt.timestamp.toString(),fromPartnerID:ASSISTANT_ID,toPartnerID:t,senderName:"Assistant",timestamp:pt.timestamp.getTime(),content:pt.content};Ft(Zt)}),F())},[Q]);const Ft=pt=>ot(Zt=>[...Zt,pt]);React.useEffect(()=>{at.length!=0&&(at.forEach(pt=>{Be(Zt=>Zt.map(Kt=>{let ur=Kt.partner1===pt.fromPartnerID&&Kt.partner2===pt.toPartnerID;if(ur||(ur=Kt.partner1===pt.toPartnerID&&Kt.partner2===pt.fromPartnerID),!ur||Kt.messages.some(Rr=>Rr.id===pt.id))return Kt;let or=1;return(Ae==null?void 0:Ae[0])==Kt.partner1&&Ae[1]==Kt.partner2&&(or=0,qt(),setTimeout(()=>{var Rr;return(Rr=tt.current)==null?void 0:Rr.scrollIntoView({behavior:"smooth"})},50),Kt.pending&&oe("approved")),{...Kt,pending:!1,unread:Kt.unread+or,messages:[...Kt.messages,pt]}}).sort(sortChats))}),ot([]))},[at,ot,Be,je,Ae]),React.useEffect(()=>{if(o===!0)return;const pt=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 pt.on("ReceiveMessage",Ft),pt.start().catch(Zt=>console.error("Error connecting to SignalR hub:",Zt)),Ze(pt),()=>{pt&&pt.stop()}},[t,o]),React.useEffect(()=>{var Zt;if(!Ae)return;const pt=yt();pt&&((Zt=Ue.current)==null||Zt.focus(),pt.unread>0&&(qt(),Be(Kt=>Kt.map(ur=>ur.partner1===Ae[0]&&ur.partner2===Ae[1]?{...ur,unread:0}:ur))),setTimeout(()=>{var Kt;return(Kt=tt.current)==null?void 0:Kt.scrollIntoView({behavior:"smooth"})},50))},[$e,Ae]);const Ke=pt=>{if(!Ae)return;const Zt={id:crypto.randomUUID(),senderName:e,fromPartnerID:t,toPartnerID:Ae[0]===t?Ae[1]:Ae[0],content:pt+(Qe?` (${Qe==null?void 0:Qe.name} attached)`:""),timestamp:Date.now()};Ft(Zt),Zt.toPartnerID==ASSISTANT_ID?(z(Zt.content,Qe??void 0),Qe&&rt(Kt=>[...Kt,Qe.name])):He.invoke("NewMessage",Zt).catch(Kt=>console.error("Error sending message:",Kt)),Oe(""),Xe(null),Ct.current&&(Ct.current.value="")},it=(pt,Zt)=>ze([pt,Zt]);if(React.useEffect(()=>{if(Fe===null)return;const pt=$e.find(Kt=>Kt.conversationID===Fe[0]);if(pt&&(pt.pending&&oe("pending"),je([pt.partner1,pt.partner2]),!(Fe[0]===-1&&!V)&&!(Fe[0]!==-1&&!He))){var Zt=Fe[1];ze(null),Zt&&Ke(Zt)}},[Fe,$e,oe,je,V,He]),React.useImperativeHandle(f,()=>({setActiveChatAndSendMessage:it})),!V)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 et=pt=>{var Kt;if(!Mt())return;const Zt=(Kt=pt.clipboardData)==null?void 0:Kt.items;if(Zt){for(let ur=0;ur<Zt.length;ur++)if(Zt[ur].type.indexOf("image")!==-1){const or=Zt[ur].getAsFile();if(or){Xe(or);return}}}},ct=()=>{!Ne.trim()||!Ae||o!==!0&&!He||Ke(Ne)},ft=pt=>{pt.target.files&&pt.target.files[0]?Xe(pt.target.files[0]):Xe(null)},dt=()=>{var pt;(pt=Ct.current)==null||pt.click()},Rt=()=>{var pt;Xe(null),Je({title:"File removed",description:"No file will be sent to the assistant.",variant:"secondary"}),(pt=Ue.current)==null||pt.focus()},zt=()=>{const Zt={messages:$e.find(Kt=>Kt.partner1===ASSISTANT_ID||Kt.partner2===ASSISTANT_ID),debug:te};_({applicationId:t,emailAddress:e,body:Zt})},Yt=async()=>{A.current&&(A.current.disabled=!0),await I({routeApplicationId:t,partnerId:"2"}),await b()},sr=()=>{Be(pt=>pt.map(Kt=>Kt.partner1!==ASSISTANT_ID&&Kt.partner2!==ASSISTANT_ID?Kt:{...Kt,messages:[]})),rt([]),se()},dr=()=>{Ae&&S({routeApplicationId:t,partnerId:Ae[0]==t?Ae[1]:Ae[0]}).then(()=>{oe("approved")})},mt=yt(),Sr=$e.filter(pt=>pt.pending).length;return jsxRuntime.jsxs("div",{className:cn("flex overflow-hidden",l),children:[o!==!0&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"w-[260px] p-4 pt-3 flex flex-col border-r",children:[jsxRuntime.jsx("div",{className:"p-4 font-semibold border-b",children:"Communications"}),$e.length>1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"p-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(Search,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),jsxRuntime.jsx(Input,{placeholder:"Search chats...",className:"pl-8 h-9",value:qe,onChange:pt=>Ge(pt.target.value)})]})}),jsxRuntime.jsx(Tabs,{value:ge,onValueChange:oe,className:"w-full mb-1",children:jsxRuntime.jsxs(TabsList,{className:"grid grid-cols-6 h-9 mx-2",children:[jsxRuntime.jsx(TabsTrigger,{value:"approved",className:"text-xs col-span-3",children:"Approved"}),jsxRuntime.jsxs(TabsTrigger,{value:"pending",className:"text-xs col-span-3",children:["Pending ",Sr>0&&`(${Sr})`]})]})})]}),jsxRuntime.jsx("div",{className:"mt-1 mb-1",children:$e.findIndex(pt=>pt.partner1==="2"||pt.partner2==="2")<0?jsxRuntime.jsx(Button,{className:"w-full",ref:A,onClick:()=>Yt(),children:"Chat with Randmar"},"b1"):ge==="approved"&&$e.length>=5?null:jsxRuntime.jsx(reactRouterDom.Link,{to:`${window.location.hostname==="dashboard.randmar.io"?"":"https://dashboard.randmar.io"}/${t}/ExploreManufacturers`,target:window.location.hostname==="dashboard.randmar.io"?"_self":"_blank",children:jsxRuntime.jsx(Button,{className:"w-full",children:"Explore Manufacturers"},"b2")})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1",children:$e.length>0&&jsxRuntime.jsx(ChatList,{userId:t,chats:Ht.filter(pt=>pt.partner1!==ASSISTANT_ID&&pt.partner2!==ASSISTANT_ID),activeChat:mt??null,onSelectChat:je})}),jsxRuntime.jsx(Separator$1,{className:"mt-auto"}),jsxRuntime.jsx("div",{className:"pt-1",children:$e.find(pt=>pt.partner1===ASSISTANT_ID||pt.partner2===ASSISTANT_ID)&&jsxRuntime.jsx(ChatList,{userId:t,chats:Ht.filter(pt=>pt.partner1===ASSISTANT_ID||pt.partner2===ASSISTANT_ID),activeChat:mt??null,onSelectChat:je,assistantStickyMode:!0})})]})}),jsxRuntime.jsx("div",{className:"flex-5 flex flex-col",children:Ae?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:Ae[0]==ASSISTANT_ID||Ae[1]==ASSISTANT_ID?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:jsxRuntime.jsx(Bot,{className:"text-primary fill-white min-h-full"})}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:"Randmar Assistant"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 ml-auto",children:[jsxRuntime.jsx(Switch,{id:"smartSwitch",disabled:!!ne,checked:C,onCheckedChange:pt=>{sr(),setTimeout(()=>E(pt),20)}}),jsxRuntime.jsx(Label$2,{htmlFor:"smartSwitch",children:"Think harder"})]}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-1",onClick:()=>sr(),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:()=>zt()},children:jsxRuntime.jsx(MessageSquareShare,{className:"h-5 w-5"})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:jsxRuntime.jsx(PartnerLogo,{id:Ae[0]===t?Ae[1]:Ae[0],width:72,height:72})}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:mt==null?void 0:mt.name}),jsxRuntime.jsx("div",{className:"flex items-center space-x-2 ml-auto",children:jsxRuntime.jsx(reactRouterDom.Link,{to:`${window.location.hostname==="dashboard.randmar.io"?"":"https://dashboard.randmar.io"}/${t}/Partner/${Ae[0]===t?Ae[1]:Ae[0]}`,target:window.location.hostname==="dashboard.randmar.io"?"_self":"_blank",children:jsxRuntime.jsx(Button,{children:"View Partner"})})})]})}),mt!=null&&mt.pending&&mt.partner1==t?jsxRuntime.jsx("p",{className:"mt-8 p-2 mx-auto",children:"This conversation is awaiting approval by the other party — please check back later."}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:[jsxRuntime.jsx(ChatMessages,{messages:(mt==null?void 0:mt.messages)??[],currentUserId:t,isAssistantChat:Mt(),botStatus:Mt()?ne:""}),jsxRuntime.jsx("div",{ref:tt})]}),jsxRuntime.jsxs("div",{className:"p-4 border-t border-r flex",children:[(mt==null?void 0:mt.pending)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{disabled:R,onClick:()=>dr(),children:[jsxRuntime.jsx(Handshake,{}),"Accept Conversation Request"]}),jsxRuntime.jsxs(Button,{disabled:!0,className:"ml-2",children:[jsxRuntime.jsx(ThumbsDown,{}),"Block Partner"]})]}),jsxRuntime.jsx(Textarea,{ref:Ue,placeholder:"Type a message...",value:Ne,onPaste:et,onChange:pt=>Oe(pt.target.value),onKeyDown:pt=>{pt.key!=="Enter"||pt.shiftKey||(pt.preventDefault(),ct())},className:mt!=null&&mt.pending?"collapse":"flex-1 resize-none"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Button,{size:"icon",variant:"default",className:mt!=null&&mt.pending?"collapse":"ml-2 h-8 w-8",disabled:!!ne||(mt==null?void 0:mt.pending),onClick:ct,children:jsxRuntime.jsx(Send,{className:"h-6 w-6"})}),Mt()&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Input,{type:"file",onChange:ft,className:"hidden",ref:Ct}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:dt,className:mt!=null&&mt.pending?"collapse":"ml-2 h-8 w-8",disabled:ne!==""||(mt==null?void 0:mt.pending)||!!Qe,children:jsxRuntime.jsx(Paperclip,{className:"h-5 w-5"})}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:Rt,className:mt!=null&&mt.pending?"collapse":"ml-2 h-8 w-8",disabled:ne!==""||(mt==null?void 0:mt.pending)||!Qe,children:jsxRuntime.jsx(Trash,{className:"h-5 w-5"})})]})]})]})]})]}):jsxRuntime.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Select a chat to start messaging"})}),jsxRuntime.jsx("div",{"data-thin":Mt(),className:"w-[480px] flex flex-col border-l flex-4 data-[thin=true]:flex-2",children:Mt()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Sources and System Info"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[Qe?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx(File,{})," ",Qe.name," (pending send...)"]})}):st.length?jsxRuntime.jsx(jsxRuntime.Fragment,{}):jsxRuntime.jsx("p",{children:"No files attached to this conversation yet."}),st.slice().reverse().map(pt=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx(File,{})," ",pt]})}))]})}),jsxRuntime.jsx(ScrollArea,{className:"flex-4 border-t pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx("div",{className:"space-y-2",children:jsxRuntime.jsx(DebugMessageDisplay,{debugMessages:te})})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Partner Overview"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx("div",{className:"mt-1",children:jsxRuntime.jsx(PartnerRelationshipPage,{applicationId:t,partnerId:((Ae==null?void 0:Ae[0])===t?Ae[1]:Ae==null?void 0:Ae[0])??t,userEmail:e,shopifyHostName:void 0,isSuperAdmin:!1})})})]})})]})});function UnsavedChangesDialog({isOpen:t,onClose:e,onConfirm:n,title:o,description:l,confirmText:d="Confirm",cancelText:f="Cancel"}){return jsxRuntime.jsx(Dialog,{open:t,onOpenChange:e,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:o}),jsxRuntime.jsx(DialogDescription,{children:l})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:e,children:f}),jsxRuntime.jsx(Button,{onClick:n,children:d})]})]})})}function useRouterNavigationGuard(t){const[e,n]=React.useState(!1),o=reactRouterDom.useBlocker(React.useCallback(({currentLocation:g,nextLocation:b})=>{const _=g.pathname!==b.pathname||g.search!==b.search||g.hash!==b.hash;return t()&&_},[t]));React.useEffect(()=>{o.state==="blocked"&&n(!0)},[o]),React.useEffect(()=>{const g=b=>{if(t())return b.preventDefault(),"You have unsaved changes. Are you sure you want to leave?"};return window.addEventListener("beforeunload",g),()=>{window.removeEventListener("beforeunload",g)}},[t]);const l=React.useCallback(()=>{n(!1),o.state==="blocked"&&o.proceed()},[o]),d=React.useCallback(()=>{n(!1),o.state==="blocked"&&o.reset()},[o]),f=React.useCallback(()=>jsxRuntime.jsx(UnsavedChangesDialog,{isOpen:e,onClose:d,onConfirm:l,title:"Unsaved Changes",description:"You have unsaved changes. Are you sure you want to leave? Your changes will be lost.",confirmText:"Discard Changes",cancelText:"Stay on Page"}),[e,d,l]);return{showDialog:e,handleConfirm:l,handleCancel:d,NavigationGuardDialog:f}}var isCheckBoxInput=t=>t.type==="checkbox",isDateObject=t=>t instanceof Date,isNullOrUndefined=t=>t==null;const isObjectType=t=>typeof t=="object";var isObject=t=>!isNullOrUndefined(t)&&!Array.isArray(t)&&isObjectType(t)&&!isDateObject(t),getEventValue=t=>isObject(t)&&t.target?isCheckBoxInput(t.target)?t.target.checked:t.target.value:t,getNodeParentName=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,isNameInFieldArray=(t,e)=>t.has(getNodeParentName(e)),isPlainObject$1=t=>{const e=t.constructor&&t.constructor.prototype;return isObject(e)&&e.hasOwnProperty("isPrototypeOf")},isWeb=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function cloneObject(t){let e;const n=Array.isArray(t),o=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(isWeb&&(t instanceof Blob||o))&&(n||isObject(t)))if(e=n?[]:{},!n&&!isPlainObject$1(t))e=t;else for(const l in t)t.hasOwnProperty(l)&&(e[l]=cloneObject(t[l]));else return t;return e}var compact=t=>Array.isArray(t)?t.filter(Boolean):[],isUndefined=t=>t===void 0,get=(t,e,n)=>{if(!e||!isObject(t))return n;const o=compact(e.split(/[,[\].]+?/)).reduce((l,d)=>isNullOrUndefined(l)?l:l[d],t);return isUndefined(o)||o===t?isUndefined(t[e])?n:t[e]:o},isBoolean=t=>typeof t=="boolean",isKey=t=>/^\w*$/.test(t),stringToPath=t=>compact(t.replace(/["|']|\]/g,"").split(/\.|\[/)),set=(t,e,n)=>{let o=-1;const l=isKey(e)?[e]:stringToPath(e),d=l.length,f=d-1;for(;++o<d;){const g=l[o];let b=n;if(o!==f){const _=t[g];b=isObject(_)||Array.isArray(_)?_:isNaN(+l[o+1])?{}:[]}if(g==="__proto__"||g==="constructor"||g==="prototype")return;t[g]=b,t=t[g]}};const EVENTS={BLUR:"blur",FOCUS_OUT:"focusout"},VALIDATION_MODE={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},INPUT_VALIDATION_RULES={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};React.createContext(null);var getProxyFormState=(t,e,n,o=!0)=>{const l={defaultValues:e._defaultValues};for(const d in t)Object.defineProperty(l,d,{get:()=>{const f=d;return e._proxyFormState[f]!==VALIDATION_MODE.all&&(e._proxyFormState[f]=!o||VALIDATION_MODE.all),t[f]}});return l};const useIsomorphicLayoutEffect$1=typeof window<"u"?React__namespace.useLayoutEffect:React__namespace.useEffect;var isString=t=>typeof t=="string",generateWatchOutput=(t,e,n,o,l)=>isString(t)?(o&&e.watch.add(t),get(n,t,l)):Array.isArray(t)?t.map(d=>(o&&e.watch.add(d),get(n,d))):(o&&(e.watchAll=!0),n),appendErrors=(t,e,n,o,l)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[o]:l||!0}}:{},convertToArrayPayload=t=>Array.isArray(t)?t:[t],createSubject=()=>{let t=[];return{get observers(){return t},next:l=>{for(const d of t)d.next&&d.next(l)},subscribe:l=>(t.push(l),{unsubscribe:()=>{t=t.filter(d=>d!==l)}}),unsubscribe:()=>{t=[]}}},isPrimitive=t=>isNullOrUndefined(t)||!isObjectType(t);function deepEqual$1(t,e){if(isPrimitive(t)||isPrimitive(e))return t===e;if(isDateObject(t)&&isDateObject(e))return t.getTime()===e.getTime();const n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(const l of n){const d=t[l];if(!o.includes(l))return!1;if(l!=="ref"){const f=e[l];if(isDateObject(d)&&isDateObject(f)||isObject(d)&&isObject(f)||Array.isArray(d)&&Array.isArray(f)?!deepEqual$1(d,f):d!==f)return!1}}return!0}var isEmptyObject$1=t=>isObject(t)&&!Object.keys(t).length,isFileInput=t=>t.type==="file",isFunction$3=t=>typeof t=="function",isHTMLElement=t=>{if(!isWeb)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},isMultipleSelect=t=>t.type==="select-multiple",isRadioInput=t=>t.type==="radio",isRadioOrCheckbox=t=>isRadioInput(t)||isCheckBoxInput(t),live=t=>isHTMLElement(t)&&t.isConnected;function baseGet(t,e){const n=e.slice(0,-1).length;let o=0;for(;o<n;)t=isUndefined(t)?o++:t[e[o++]];return t}function isEmptyArray(t){for(const e in t)if(t.hasOwnProperty(e)&&!isUndefined(t[e]))return!1;return!0}function unset(t,e){const n=Array.isArray(e)?e:isKey(e)?[e]:stringToPath(e),o=n.length===1?t:baseGet(t,n),l=n.length-1,d=n[l];return o&&delete o[d],l!==0&&(isObject(o)&&isEmptyObject$1(o)||Array.isArray(o)&&isEmptyArray(o))&&unset(t,n.slice(0,-1)),t}var objectHasFunction=t=>{for(const e in t)if(isFunction$3(t[e]))return!0;return!1};function markFieldsDirty(t,e={}){const n=Array.isArray(t);if(isObject(t)||n)for(const o in t)Array.isArray(t[o])||isObject(t[o])&&!objectHasFunction(t[o])?(e[o]=Array.isArray(t[o])?[]:{},markFieldsDirty(t[o],e[o])):isNullOrUndefined(t[o])||(e[o]=!0);return e}function getDirtyFieldsFromDefaultValues(t,e,n){const o=Array.isArray(t);if(isObject(t)||o)for(const l in t)Array.isArray(t[l])||isObject(t[l])&&!objectHasFunction(t[l])?isUndefined(e)||isPrimitive(n[l])?n[l]=Array.isArray(t[l])?markFieldsDirty(t[l],[]):{...markFieldsDirty(t[l])}:getDirtyFieldsFromDefaultValues(t[l],isNullOrUndefined(e)?{}:e[l],n[l]):n[l]=!deepEqual$1(t[l],e[l]);return n}var getDirtyFields=(t,e)=>getDirtyFieldsFromDefaultValues(t,e,markFieldsDirty(e));const defaultResult={value:!1,isValid:!1},validResult={value:!0,isValid:!0};var getCheckboxValue=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!isUndefined(t[0].attributes.value)?isUndefined(t[0].value)||t[0].value===""?validResult:{value:t[0].value,isValid:!0}:validResult:defaultResult}return defaultResult},getFieldValueAs=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:o})=>isUndefined(t)?t:e?t===""?NaN:t&&+t:n&&isString(t)?new Date(t):o?o(t):t;const defaultReturn={isValid:!1,value:null};var getRadioValue=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,defaultReturn):defaultReturn;function getFieldValue(t){const e=t.ref;return isFileInput(e)?e.files:isRadioInput(e)?getRadioValue(t.refs).value:isMultipleSelect(e)?[...e.selectedOptions].map(({value:n})=>n):isCheckBoxInput(e)?getCheckboxValue(t.refs).value:getFieldValueAs(isUndefined(e.value)?t.ref.value:e.value,t)}var getResolverOptions=(t,e,n,o)=>{const l={};for(const d of t){const f=get(e,d);f&&set(l,d,f._f)}return{criteriaMode:n,names:[...t],fields:l,shouldUseNativeValidation:o}},isRegex=t=>t instanceof RegExp,getRuleValue=t=>isUndefined(t)?t:isRegex(t)?t.source:isObject(t)?isRegex(t.value)?t.value.source:t.value:t,getValidationModes=t=>({isOnSubmit:!t||t===VALIDATION_MODE.onSubmit,isOnBlur:t===VALIDATION_MODE.onBlur,isOnChange:t===VALIDATION_MODE.onChange,isOnAll:t===VALIDATION_MODE.all,isOnTouch:t===VALIDATION_MODE.onTouched});const ASYNC_FUNCTION="AsyncFunction";var hasPromiseValidation=t=>!!t&&!!t.validate&&!!(isFunction$3(t.validate)&&t.validate.constructor.name===ASYNC_FUNCTION||isObject(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===ASYNC_FUNCTION)),hasValidation=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),isWatched=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(o=>t.startsWith(o)&&/^\.\w+/.test(t.slice(o.length))));const iterateFieldsByAction=(t,e,n,o)=>{for(const l of n||Object.keys(t)){const d=get(t,l);if(d){const{_f:f,...g}=d;if(f){if(f.refs&&f.refs[0]&&e(f.refs[0],l)&&!o)return!0;if(f.ref&&e(f.ref,f.name)&&!o)return!0;if(iterateFieldsByAction(g,e))break}else if(isObject(g)&&iterateFieldsByAction(g,e))break}}};function schemaErrorLookup(t,e,n){const o=get(t,n);if(o||isKey(n))return{error:o,name:n};const l=n.split(".");for(;l.length;){const d=l.join("."),f=get(e,d),g=get(t,d);if(f&&!Array.isArray(f)&&n!==d)return{name:n};if(g&&g.type)return{name:d,error:g};if(g&&g.root&&g.root.type)return{name:`${d}.root`,error:g.root};l.pop()}return{name:n}}var shouldRenderFormState=(t,e,n,o)=>{n(t);const{name:l,...d}=t;return isEmptyObject$1(d)||Object.keys(d).length>=Object.keys(e).length||Object.keys(d).find(f=>e[f]===(!o||VALIDATION_MODE.all))},shouldSubscribeByName=(t,e,n)=>!t||!e||t===e||convertToArrayPayload(t).some(o=>o&&(n?o===e:o.startsWith(e)||e.startsWith(o))),skipValidation=(t,e,n,o,l)=>l.isOnAll?!1:!n&&l.isOnTouch?!(e||t):(n?o.isOnBlur:l.isOnBlur)?!t:(n?o.isOnChange:l.isOnChange)?t:!0,unsetEmptyArray=(t,e)=>!compact(get(t,e)).length&&unset(t,e),updateFieldArrayRootError=(t,e,n)=>{const o=convertToArrayPayload(get(t,n));return set(o,"root",e[n]),set(t,n,o),t},isMessage=t=>isString(t);function getValidateError(t,e,n="validate"){if(isMessage(t)||Array.isArray(t)&&t.every(isMessage)||isBoolean(t)&&!t)return{type:n,message:isMessage(t)?t:"",ref:e}}var getValueAndMessage=t=>isObject(t)&&!isRegex(t)?t:{value:t,message:""},validateField=async(t,e,n,o,l,d)=>{const{ref:f,refs:g,required:b,maxLength:_,minLength:S,min:R,max:C,pattern:E,validate:A,name:M,valueAsNumber:I,mount:j}=t._f,q=get(n,M);if(!j||e.has(M))return{};const z=g?g[0]:f,Q=Ae=>{l&&z.reportValidity&&(z.setCustomValidity(isBoolean(Ae)?"":Ae||""),z.reportValidity())},F={},V=isRadioInput(f),te=isCheckBoxInput(f),ne=V||te,se=(I||isFileInput(f))&&isUndefined(f.value)&&isUndefined(q)||isHTMLElement(f)&&f.value===""||q===""||Array.isArray(q)&&!q.length,ge=appendErrors.bind(null,M,o,F),oe=(Ae,je,Ne,Oe=INPUT_VALIDATION_RULES.maxLength,Fe=INPUT_VALIDATION_RULES.minLength)=>{const ze=Ae?je:Ne;F[M]={type:Ae?Oe:Fe,message:ze,ref:f,...ge(Ae?Oe:Fe,ze)}};if(d?!Array.isArray(q)||!q.length:b&&(!ne&&(se||isNullOrUndefined(q))||isBoolean(q)&&!q||te&&!getCheckboxValue(g).isValid||V&&!getRadioValue(g).isValid)){const{value:Ae,message:je}=isMessage(b)?{value:!!b,message:b}:getValueAndMessage(b);if(Ae&&(F[M]={type:INPUT_VALIDATION_RULES.required,message:je,ref:z,...ge(INPUT_VALIDATION_RULES.required,je)},!o))return Q(je),F}if(!se&&(!isNullOrUndefined(R)||!isNullOrUndefined(C))){let Ae,je;const Ne=getValueAndMessage(C),Oe=getValueAndMessage(R);if(!isNullOrUndefined(q)&&!isNaN(q)){const Fe=f.valueAsNumber||q&&+q;isNullOrUndefined(Ne.value)||(Ae=Fe>Ne.value),isNullOrUndefined(Oe.value)||(je=Fe<Oe.value)}else{const Fe=f.valueAsDate||new Date(q),ze=qe=>new Date(new Date().toDateString()+" "+qe),$e=f.type=="time",Be=f.type=="week";isString(Ne.value)&&q&&(Ae=$e?ze(q)>ze(Ne.value):Be?q>Ne.value:Fe>new Date(Ne.value)),isString(Oe.value)&&q&&(je=$e?ze(q)<ze(Oe.value):Be?q<Oe.value:Fe<new Date(Oe.value))}if((Ae||je)&&(oe(!!Ae,Ne.message,Oe.message,INPUT_VALIDATION_RULES.max,INPUT_VALIDATION_RULES.min),!o))return Q(F[M].message),F}if((_||S)&&!se&&(isString(q)||d&&Array.isArray(q))){const Ae=getValueAndMessage(_),je=getValueAndMessage(S),Ne=!isNullOrUndefined(Ae.value)&&q.length>+Ae.value,Oe=!isNullOrUndefined(je.value)&&q.length<+je.value;if((Ne||Oe)&&(oe(Ne,Ae.message,je.message),!o))return Q(F[M].message),F}if(E&&!se&&isString(q)){const{value:Ae,message:je}=getValueAndMessage(E);if(isRegex(Ae)&&!q.match(Ae)&&(F[M]={type:INPUT_VALIDATION_RULES.pattern,message:je,ref:f,...ge(INPUT_VALIDATION_RULES.pattern,je)},!o))return Q(je),F}if(A){if(isFunction$3(A)){const Ae=await A(q,n),je=getValidateError(Ae,z);if(je&&(F[M]={...je,...ge(INPUT_VALIDATION_RULES.validate,je.message)},!o))return Q(je.message),F}else if(isObject(A)){let Ae={};for(const je in A){if(!isEmptyObject$1(Ae)&&!o)break;const Ne=getValidateError(await A[je](q,n),z,je);Ne&&(Ae={...Ne,...ge(je,Ne.message)},Q(Ne.message),o&&(F[M]=Ae))}if(!isEmptyObject$1(Ae)&&(F[M]={ref:z,...Ae},!o))return F}}return Q(!0),F};const defaultOptions$1={mode:VALIDATION_MODE.onSubmit,reValidateMode:VALIDATION_MODE.onChange,shouldFocusError:!0};function createFormControl(t={}){let e={...defaultOptions$1,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:isFunction$3(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1};const o={};let l=isObject(e.defaultValues)||isObject(e.values)?cloneObject(e.defaultValues||e.values)||{}:{},d=e.shouldUnregister?{}:cloneObject(l),f={action:!1,mount:!1,watch:!1},g={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},b,_=0;const S={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let R={...S};const C={array:createSubject(),state:createSubject()},E=e.criteriaMode===VALIDATION_MODE.all,A=Ke=>it=>{clearTimeout(_),_=setTimeout(Ke,it)},M=async Ke=>{if(!e.disabled&&(S.isValid||R.isValid||Ke)){const it=e.resolver?isEmptyObject$1((await te()).errors):await se(o,!0);it!==n.isValid&&C.state.next({isValid:it})}},I=(Ke,it)=>{!e.disabled&&(S.isValidating||S.validatingFields||R.isValidating||R.validatingFields)&&((Ke||Array.from(g.mount)).forEach(et=>{et&&(it?set(n.validatingFields,et,it):unset(n.validatingFields,et))}),C.state.next({validatingFields:n.validatingFields,isValidating:!isEmptyObject$1(n.validatingFields)}))},j=(Ke,it=[],et,ct,ft=!0,dt=!0)=>{if(ct&&et&&!e.disabled){if(f.action=!0,dt&&Array.isArray(get(o,Ke))){const Rt=et(get(o,Ke),ct.argA,ct.argB);ft&&set(o,Ke,Rt)}if(dt&&Array.isArray(get(n.errors,Ke))){const Rt=et(get(n.errors,Ke),ct.argA,ct.argB);ft&&set(n.errors,Ke,Rt),unsetEmptyArray(n.errors,Ke)}if((S.touchedFields||R.touchedFields)&&dt&&Array.isArray(get(n.touchedFields,Ke))){const Rt=et(get(n.touchedFields,Ke),ct.argA,ct.argB);ft&&set(n.touchedFields,Ke,Rt)}(S.dirtyFields||R.dirtyFields)&&(n.dirtyFields=getDirtyFields(l,d)),C.state.next({name:Ke,isDirty:oe(Ke,it),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else set(d,Ke,it)},q=(Ke,it)=>{set(n.errors,Ke,it),C.state.next({errors:n.errors})},z=Ke=>{n.errors=Ke,C.state.next({errors:n.errors,isValid:!1})},Q=(Ke,it,et,ct)=>{const ft=get(o,Ke);if(ft){const dt=get(d,Ke,isUndefined(et)?get(l,Ke):et);isUndefined(dt)||ct&&ct.defaultChecked||it?set(d,Ke,it?dt:getFieldValue(ft._f)):Ne(Ke,dt),f.mount&&M()}},F=(Ke,it,et,ct,ft)=>{let dt=!1,Rt=!1;const zt={name:Ke};if(!e.disabled){if(!et||ct){(S.isDirty||R.isDirty)&&(Rt=n.isDirty,n.isDirty=zt.isDirty=oe(),dt=Rt!==zt.isDirty);const Yt=deepEqual$1(get(l,Ke),it);Rt=!!get(n.dirtyFields,Ke),Yt?unset(n.dirtyFields,Ke):set(n.dirtyFields,Ke,!0),zt.dirtyFields=n.dirtyFields,dt=dt||(S.dirtyFields||R.dirtyFields)&&Rt!==!Yt}if(et){const Yt=get(n.touchedFields,Ke);Yt||(set(n.touchedFields,Ke,et),zt.touchedFields=n.touchedFields,dt=dt||(S.touchedFields||R.touchedFields)&&Yt!==et)}dt&&ft&&C.state.next(zt)}return dt?zt:{}},V=(Ke,it,et,ct)=>{const ft=get(n.errors,Ke),dt=(S.isValid||R.isValid)&&isBoolean(it)&&n.isValid!==it;if(e.delayError&&et?(b=A(()=>q(Ke,et)),b(e.delayError)):(clearTimeout(_),b=null,et?set(n.errors,Ke,et):unset(n.errors,Ke)),(et?!deepEqual$1(ft,et):ft)||!isEmptyObject$1(ct)||dt){const Rt={...ct,...dt&&isBoolean(it)?{isValid:it}:{},errors:n.errors,name:Ke};n={...n,...Rt},C.state.next(Rt)}},te=async Ke=>{I(Ke,!0);const it=await e.resolver(d,e.context,getResolverOptions(Ke||g.mount,o,e.criteriaMode,e.shouldUseNativeValidation));return I(Ke),it},ne=async Ke=>{const{errors:it}=await te(Ke);if(Ke)for(const et of Ke){const ct=get(it,et);ct?set(n.errors,et,ct):unset(n.errors,et)}else n.errors=it;return it},se=async(Ke,it,et={valid:!0})=>{for(const ct in Ke){const ft=Ke[ct];if(ft){const{_f:dt,...Rt}=ft;if(dt){const zt=g.array.has(dt.name),Yt=ft._f&&hasPromiseValidation(ft._f);Yt&&S.validatingFields&&I([ct],!0);const sr=await validateField(ft,g.disabled,d,E,e.shouldUseNativeValidation&&!it,zt);if(Yt&&S.validatingFields&&I([ct]),sr[dt.name]&&(et.valid=!1,it))break;!it&&(get(sr,dt.name)?zt?updateFieldArrayRootError(n.errors,sr,dt.name):set(n.errors,dt.name,sr[dt.name]):unset(n.errors,dt.name))}!isEmptyObject$1(Rt)&&await se(Rt,it,et)}}return et.valid},ge=()=>{for(const Ke of g.unMount){const it=get(o,Ke);it&&(it._f.refs?it._f.refs.every(et=>!live(et)):!live(it._f.ref))&&Xe(Ke)}g.unMount=new Set},oe=(Ke,it)=>!e.disabled&&(Ke&&it&&set(d,Ke,it),!deepEqual$1(qe(),l)),Ae=(Ke,it,et)=>generateWatchOutput(Ke,g,{...f.mount?d:isUndefined(it)?l:isString(Ke)?{[Ke]:it}:it},et,it),je=Ke=>compact(get(f.mount?d:l,Ke,e.shouldUnregister?get(l,Ke,[]):[])),Ne=(Ke,it,et={})=>{const ct=get(o,Ke);let ft=it;if(ct){const dt=ct._f;dt&&(!dt.disabled&&set(d,Ke,getFieldValueAs(it,dt)),ft=isHTMLElement(dt.ref)&&isNullOrUndefined(it)?"":it,isMultipleSelect(dt.ref)?[...dt.ref.options].forEach(Rt=>Rt.selected=ft.includes(Rt.value)):dt.refs?isCheckBoxInput(dt.ref)?dt.refs.forEach(Rt=>{(!Rt.defaultChecked||!Rt.disabled)&&(Array.isArray(ft)?Rt.checked=!!ft.find(zt=>zt===Rt.value):Rt.checked=ft===Rt.value||!!ft)}):dt.refs.forEach(Rt=>Rt.checked=Rt.value===ft):isFileInput(dt.ref)?dt.ref.value="":(dt.ref.value=ft,dt.ref.type||C.state.next({name:Ke,values:cloneObject(d)})))}(et.shouldDirty||et.shouldTouch)&&F(Ke,ft,et.shouldTouch,et.shouldDirty,!0),et.shouldValidate&&Be(Ke)},Oe=(Ke,it,et)=>{for(const ct in it){if(!it.hasOwnProperty(ct))return;const ft=it[ct],dt=Ke+"."+ct,Rt=get(o,dt);(g.array.has(Ke)||isObject(ft)||Rt&&!Rt._f)&&!isDateObject(ft)?Oe(dt,ft,et):Ne(dt,ft,et)}},Fe=(Ke,it,et={})=>{const ct=get(o,Ke),ft=g.array.has(Ke),dt=cloneObject(it);set(d,Ke,dt),ft?(C.array.next({name:Ke,values:cloneObject(d)}),(S.isDirty||S.dirtyFields||R.isDirty||R.dirtyFields)&&et.shouldDirty&&C.state.next({name:Ke,dirtyFields:getDirtyFields(l,d),isDirty:oe(Ke,dt)})):ct&&!ct._f&&!isNullOrUndefined(dt)?Oe(Ke,dt,et):Ne(Ke,dt,et),isWatched(Ke,g)&&C.state.next({...n}),C.state.next({name:f.mount?Ke:void 0,values:cloneObject(d)})},ze=async Ke=>{f.mount=!0;const it=Ke.target;let et=it.name,ct=!0;const ft=get(o,et),dt=Yt=>{ct=Number.isNaN(Yt)||isDateObject(Yt)&&isNaN(Yt.getTime())||deepEqual$1(Yt,get(d,et,Yt))},Rt=getValidationModes(e.mode),zt=getValidationModes(e.reValidateMode);if(ft){let Yt,sr;const dr=it.type?getFieldValue(ft._f):getEventValue(Ke),mt=Ke.type===EVENTS.BLUR||Ke.type===EVENTS.FOCUS_OUT,Sr=!hasValidation(ft._f)&&!e.resolver&&!get(n.errors,et)&&!ft._f.deps||skipValidation(mt,get(n.touchedFields,et),n.isSubmitted,zt,Rt),pt=isWatched(et,g,mt);set(d,et,dr),mt?(ft._f.onBlur&&ft._f.onBlur(Ke),b&&b(0)):ft._f.onChange&&ft._f.onChange(Ke);const Zt=F(et,dr,mt),Kt=!isEmptyObject$1(Zt)||pt;if(!mt&&C.state.next({name:et,type:Ke.type,values:cloneObject(d)}),Sr)return(S.isValid||R.isValid)&&(e.mode==="onBlur"?mt&&M():mt||M()),Kt&&C.state.next({name:et,...pt?{}:Zt});if(!mt&&pt&&C.state.next({...n}),e.resolver){const{errors:ur}=await te([et]);if(dt(dr),ct){const or=schemaErrorLookup(n.errors,o,et),Rr=schemaErrorLookup(ur,o,or.name||et);Yt=Rr.error,et=Rr.name,sr=isEmptyObject$1(ur)}}else I([et],!0),Yt=(await validateField(ft,g.disabled,d,E,e.shouldUseNativeValidation))[et],I([et]),dt(dr),ct&&(Yt?sr=!1:(S.isValid||R.isValid)&&(sr=await se(o,!0)));ct&&(ft._f.deps&&Be(ft._f.deps),V(et,sr,Yt,Zt))}},$e=(Ke,it)=>{if(get(n.errors,it)&&Ke.focus)return Ke.focus(),1},Be=async(Ke,it={})=>{let et,ct;const ft=convertToArrayPayload(Ke);if(e.resolver){const dt=await ne(isUndefined(Ke)?Ke:ft);et=isEmptyObject$1(dt),ct=Ke?!ft.some(Rt=>get(dt,Rt)):et}else Ke?(ct=(await Promise.all(ft.map(async dt=>{const Rt=get(o,dt);return await se(Rt&&Rt._f?{[dt]:Rt}:Rt)}))).every(Boolean),!(!ct&&!n.isValid)&&M()):ct=et=await se(o);return C.state.next({...!isString(Ke)||(S.isValid||R.isValid)&&et!==n.isValid?{}:{name:Ke},...e.resolver||!Ke?{isValid:et}:{},errors:n.errors}),it.shouldFocus&&!ct&&iterateFieldsByAction(o,$e,Ke?ft:g.mount),ct},qe=Ke=>{const it={...f.mount?d:l};return isUndefined(Ke)?it:isString(Ke)?get(it,Ke):Ke.map(et=>get(it,et))},Ge=(Ke,it)=>({invalid:!!get((it||n).errors,Ke),isDirty:!!get((it||n).dirtyFields,Ke),error:get((it||n).errors,Ke),isValidating:!!get(n.validatingFields,Ke),isTouched:!!get((it||n).touchedFields,Ke)}),He=Ke=>{Ke&&convertToArrayPayload(Ke).forEach(it=>unset(n.errors,it)),C.state.next({errors:Ke?n.errors:{}})},Ze=(Ke,it,et)=>{const ct=(get(o,Ke,{_f:{}})._f||{}).ref,ft=get(n.errors,Ke)||{},{ref:dt,message:Rt,type:zt,...Yt}=ft;set(n.errors,Ke,{...Yt,...it,ref:ct}),C.state.next({name:Ke,errors:n.errors,isValid:!1}),et&&et.shouldFocus&&ct&&ct.focus&&ct.focus()},tt=(Ke,it)=>isFunction$3(Ke)?C.state.subscribe({next:et=>Ke(Ae(void 0,it),et)}):Ae(Ke,it,!0),Ye=Ke=>C.state.subscribe({next:it=>{shouldSubscribeByName(Ke.name,it.name,Ke.exact)&&shouldRenderFormState(it,Ke.formState||S,qt,Ke.reRenderRoot)&&Ke.callback({values:{...d},...n,...it})}}).unsubscribe,Qe=Ke=>(f.mount=!0,R={...R,...Ke.formState},Ye({...Ke,formState:R})),Xe=(Ke,it={})=>{for(const et of Ke?convertToArrayPayload(Ke):g.mount)g.mount.delete(et),g.array.delete(et),it.keepValue||(unset(o,et),unset(d,et)),!it.keepError&&unset(n.errors,et),!it.keepDirty&&unset(n.dirtyFields,et),!it.keepTouched&&unset(n.touchedFields,et),!it.keepIsValidating&&unset(n.validatingFields,et),!e.shouldUnregister&&!it.keepDefaultValue&&unset(l,et);C.state.next({values:cloneObject(d)}),C.state.next({...n,...it.keepDirty?{isDirty:oe()}:{}}),!it.keepIsValid&&M()},st=({disabled:Ke,name:it})=>{(isBoolean(Ke)&&f.mount||Ke||g.disabled.has(it))&&(Ke?g.disabled.add(it):g.disabled.delete(it))},rt=(Ke,it={})=>{let et=get(o,Ke);const ct=isBoolean(it.disabled)||isBoolean(e.disabled);return set(o,Ke,{...et||{},_f:{...et&&et._f?et._f:{ref:{name:Ke}},name:Ke,mount:!0,...it}}),g.mount.add(Ke),et?st({disabled:isBoolean(it.disabled)?it.disabled:e.disabled,name:Ke}):Q(Ke,!0,it.value),{...ct?{disabled:it.disabled||e.disabled}:{},...e.progressive?{required:!!it.required,min:getRuleValue(it.min),max:getRuleValue(it.max),minLength:getRuleValue(it.minLength),maxLength:getRuleValue(it.maxLength),pattern:getRuleValue(it.pattern)}:{},name:Ke,onChange:ze,onBlur:ze,ref:ft=>{if(ft){rt(Ke,it),et=get(o,Ke);const dt=isUndefined(ft.value)&&ft.querySelectorAll&&ft.querySelectorAll("input,select,textarea")[0]||ft,Rt=isRadioOrCheckbox(dt),zt=et._f.refs||[];if(Rt?zt.find(Yt=>Yt===dt):dt===et._f.ref)return;set(o,Ke,{_f:{...et._f,...Rt?{refs:[...zt.filter(live),dt,...Array.isArray(get(l,Ke))?[{}]:[]],ref:{type:dt.type,name:Ke}}:{ref:dt}}}),Q(Ke,!1,void 0,dt)}else et=get(o,Ke,{}),et._f&&(et._f.mount=!1),(e.shouldUnregister||it.shouldUnregister)&&!(isNameInFieldArray(g.array,Ke)&&f.action)&&g.unMount.add(Ke)}}},at=()=>e.shouldFocusError&&iterateFieldsByAction(o,$e,g.mount),ot=Ke=>{isBoolean(Ke)&&(C.state.next({disabled:Ke}),iterateFieldsByAction(o,(it,et)=>{const ct=get(o,et);ct&&(it.disabled=ct._f.disabled||Ke,Array.isArray(ct._f.refs)&&ct._f.refs.forEach(ft=>{ft.disabled=ct._f.disabled||Ke}))},0,!1))},Ue=(Ke,it)=>async et=>{let ct;et&&(et.preventDefault&&et.preventDefault(),et.persist&&et.persist());let ft=cloneObject(d);if(C.state.next({isSubmitting:!0}),e.resolver){const{errors:dt,values:Rt}=await te();n.errors=dt,ft=Rt}else await se(o);if(g.disabled.size)for(const dt of g.disabled)set(ft,dt,void 0);if(unset(n.errors,"root"),isEmptyObject$1(n.errors)){C.state.next({errors:{}});try{await Ke(ft,et)}catch(dt){ct=dt}}else it&&await it({...n.errors},et),at(),setTimeout(at);if(C.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:isEmptyObject$1(n.errors)&&!ct,submitCount:n.submitCount+1,errors:n.errors}),ct)throw ct},Ct=(Ke,it={})=>{get(o,Ke)&&(isUndefined(it.defaultValue)?Fe(Ke,cloneObject(get(l,Ke))):(Fe(Ke,it.defaultValue),set(l,Ke,cloneObject(it.defaultValue))),it.keepTouched||unset(n.touchedFields,Ke),it.keepDirty||(unset(n.dirtyFields,Ke),n.isDirty=it.defaultValue?oe(Ke,cloneObject(get(l,Ke))):oe()),it.keepError||(unset(n.errors,Ke),S.isValid&&M()),C.state.next({...n}))},Je=(Ke,it={})=>{const et=Ke?cloneObject(Ke):l,ct=cloneObject(et),ft=isEmptyObject$1(Ke),dt=ft?l:ct;if(it.keepDefaultValues||(l=et),!it.keepValues){if(it.keepDirtyValues){const Rt=new Set([...g.mount,...Object.keys(getDirtyFields(l,d))]);for(const zt of Array.from(Rt))get(n.dirtyFields,zt)?set(dt,zt,get(d,zt)):Fe(zt,get(dt,zt))}else{if(isWeb&&isUndefined(Ke))for(const Rt of g.mount){const zt=get(o,Rt);if(zt&&zt._f){const Yt=Array.isArray(zt._f.refs)?zt._f.refs[0]:zt._f.ref;if(isHTMLElement(Yt)){const sr=Yt.closest("form");if(sr){sr.reset();break}}}}for(const Rt of g.mount)Fe(Rt,get(dt,Rt))}d=cloneObject(dt),C.array.next({values:{...dt}}),C.state.next({values:{...dt}})}g={mount:it.keepDirtyValues?g.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},f.mount=!S.isValid||!!it.keepIsValid||!!it.keepDirtyValues,f.watch=!!e.shouldUnregister,C.state.next({submitCount:it.keepSubmitCount?n.submitCount:0,isDirty:ft?!1:it.keepDirty?n.isDirty:!!(it.keepDefaultValues&&!deepEqual$1(Ke,l)),isSubmitted:it.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ft?{}:it.keepDirtyValues?it.keepDefaultValues&&d?getDirtyFields(l,d):n.dirtyFields:it.keepDefaultValues&&Ke?getDirtyFields(l,Ke):it.keepDirty?n.dirtyFields:{},touchedFields:it.keepTouched?n.touchedFields:{},errors:it.keepErrors?n.errors:{},isSubmitSuccessful:it.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},yt=(Ke,it)=>Je(isFunction$3(Ke)?Ke(d):Ke,it),Mt=(Ke,it={})=>{const et=get(o,Ke),ct=et&&et._f;if(ct){const ft=ct.refs?ct.refs[0]:ct.ref;ft.focus&&(ft.focus(),it.shouldSelect&&isFunction$3(ft.select)&&ft.select())}},qt=Ke=>{n={...n,...Ke}},Ft={control:{register:rt,unregister:Xe,getFieldState:Ge,handleSubmit:Ue,setError:Ze,_subscribe:Ye,_runSchema:te,_focusError:at,_getWatch:Ae,_getDirty:oe,_setValid:M,_setFieldArray:j,_setDisabledField:st,_setErrors:z,_getFieldArray:je,_reset:Je,_resetDefaultValues:()=>isFunction$3(e.defaultValues)&&e.defaultValues().then(Ke=>{yt(Ke,e.resetOptions),C.state.next({isLoading:!1})}),_removeUnmounted:ge,_disableForm:ot,_subjects:C,_proxyFormState:S,get _fields(){return o},get _formValues(){return d},get _state(){return f},set _state(Ke){f=Ke},get _defaultValues(){return l},get _names(){return g},set _names(Ke){g=Ke},get _formState(){return n},get _options(){return e},set _options(Ke){e={...e,...Ke}}},subscribe:Qe,trigger:Be,register:rt,handleSubmit:Ue,watch:tt,setValue:Fe,getValues:qe,reset:yt,resetField:Ct,clearErrors:He,unregister:Xe,setError:Ze,setFocus:Mt,getFieldState:Ge};return{...Ft,formControl:Ft}}function useForm(t={}){const e=React.useRef(void 0),n=React.useRef(void 0),[o,l]=React.useState({isDirty:!1,isValidating:!1,isLoading:isFunction$3(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:isFunction$3(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...t.formControl?t.formControl:createFormControl(t),formState:o},t.formControl&&t.defaultValues&&!isFunction$3(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions));const d=e.current.control;return d._options=t,useIsomorphicLayoutEffect$1(()=>{const f=d._subscribe({formState:d._proxyFormState,callback:()=>l({...d._formState}),reRenderRoot:!0});return l(g=>({...g,isReady:!0})),d._formState.isReady=!0,f},[d]),React.useEffect(()=>d._disableForm(t.disabled),[d,t.disabled]),React.useEffect(()=>{t.mode&&(d._options.mode=t.mode),t.reValidateMode&&(d._options.reValidateMode=t.reValidateMode)},[d,t.mode,t.reValidateMode]),React.useEffect(()=>{t.errors&&(d._setErrors(t.errors),d._focusError())},[d,t.errors]),React.useEffect(()=>{t.shouldUnregister&&d._subjects.state.next({values:d._getWatch()})},[d,t.shouldUnregister]),React.useEffect(()=>{if(d._proxyFormState.isDirty){const f=d._getDirty();f!==o.isDirty&&d._subjects.state.next({isDirty:f})}},[d,o.isDirty]),React.useEffect(()=>{t.values&&!deepEqual$1(t.values,n.current)?(d._reset(t.values,d._options.resetOptions),n.current=t.values,l(f=>({...f}))):d._resetDefaultValues()},[d,t.values]),React.useEffect(()=>{d._state.mount||(d._setValid(),d._state.mount=!0),d._state.watch&&(d._state.watch=!1,d._subjects.state.next({...d._formState})),d._removeUnmounted()}),e.current.formState=getProxyFormState(o,d),e.current}var defaultErrorHandler=function(t){process.env.NODE_ENV!=="production"&&console.error(t)},defaultWarnHandler=function(t){process.env.NODE_ENV!=="production"&&console.warn(t)},DEFAULT_INTL_CONFIG={formats:{},messages:{},timeZone:void 0,defaultLocale:"en",defaultFormats:{},fallbackOnEmptyString:!0,onError:defaultErrorHandler,onWarn:defaultWarnHandler};function invariant(t,e,n){if(n===void 0&&(n=Error),!t)throw new n(e)}function invariantIntlContext(t){invariant(t,"[React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry.")}__assign$1(__assign$1({},DEFAULT_INTL_CONFIG),{textComponent:React__namespace.Fragment});var reactIs={exports:{}},reactIs_production_min={};/** @license React v16.13.1
1059
1059
  * react-is.production.min.js
1060
1060
  *
1061
1061
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -1074,9 +1074,9 @@ Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An err
1074
1074
  - less than the value passed to \`max\` (or ${DEFAULT_MAX} if no \`max\` prop is set)
1075
1075
  - \`null\` or \`undefined\` if the progress is indeterminate.
1076
1076
 
1077
- Defaulting to \`null\`.`}var Root=Progress$1,Indicator=ProgressIndicator;const Progress=React__namespace.forwardRef(({className:t,value:e,...n},o)=>jsxRuntime.jsx(Root,{ref:o,className:cn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...n,children:jsxRuntime.jsx(Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));Progress.displayName=Root.displayName;function ManufacturerInventoryFinanceCard({manufacturer:t,isLoading:e}){const{data:n,isLoading:o,isFetching:l}=useGetV4ManufacturerByRouteManufacturerIdInventoryValueQuery({routeManufacturerId:(t==null?void 0:t.ManufacturerId)??""},{skip:!(t!=null&&t.ManufacturerId)}),d=(t==null?void 0:t.DefaultMaxInventoryValue)??0,f=(n||[]).reduce((_,S)=>_+(S.InventoryValue||0),0),g=d-f,b=Math.round(f/d*100);return e||o||l?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/2 mt-2"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-2 w-full"})]})]})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(DollarSign,{className:"h-5 w-5 text-muted-foreground"}),"Inventory Finance"]}),jsxRuntime.jsx(CardDescription,{children:"Current inventory financial status"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Max Allowance"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(d)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Current Funds"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(f)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Available Funds"}),jsxRuntime.jsx("span",{className:`font-bold ${g>=0?"text-emerald-600 dark:text-emerald-500":"text-red-600 dark:text-red-500"}`,children:formatMoney(g)})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Budget Usage"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:[b,"%"]}),b>80&&jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4 text-amber-500"})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:b>80?"High usage alert":"Budget usage"})})]})})]}),jsxRuntime.jsx(Progress,{value:b,className:"h-2"})]})]})]})}function ManufacturerCreditFinanceCard({manufacturer:t,isLoading:e}){const n=(t==null?void 0:t.CreditLimit)??0,o=(t==null?void 0:t.OutstandingBalance)??0,l=n-o,d=Math.round(o/n*100);return e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/2 mt-2"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-2 w-full"})]})]})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(CreditCard,{className:"h-5 w-5 text-muted-foreground"}),"Credit Finance"]}),jsxRuntime.jsx(CardDescription,{children:"Current credit financial status"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Credit Limit"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(n)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Outstanding Balance"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(o)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Available Credit"}),jsxRuntime.jsx("span",{className:`font-bold ${l>=0?"text-emerald-600 dark:text-emerald-500":"text-red-600 dark:text-red-500"}`,children:formatMoney(l)})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Credit Usage"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:[d,"%"]}),d>80&&jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4 text-amber-500"})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:d>80?"High credit usage alert":"Credit usage"})})]})})]}),jsxRuntime.jsx(Progress,{value:d,className:"h-2"})]})]})]})}function SalesChartCard({statistics:t,loading:e=!1,mode:n="month",chartHeight:o=300,className:l,size:d="default"}){return e?jsxRuntime.jsxs(Card,{className:cn("w-full",l),children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-48 rounded-md"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{style:{height:o},children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full rounded-md"})}),d==="default"&&n==="month"&&jsxRuntime.jsxs("div",{className:"mt-4 flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40 rounded-md"})]})]})]}):jsxRuntime.jsxs(Card,{className:cn("w-full",l),children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:n==="week"?"Weekly Sales Performance":"Monthly Sales Performance"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(SalesChart,{statistics:t,mode:n,chartHeight:o,size:d})})]})}function ManufacturerOverviewPage({applicationId:t,readonly:e,withReports:n,manufacturer:o,userEmail:l}){const{data:d,isLoading:f,isError:g}=useGetV4PartnerByApplicationIdAccountManufacturerQuery({applicationId:t,withSpecification:!0},{skip:!!o}),[b,_]=React.useState({publicInfo:{hasUnsavedChanges:!1},qualifications:{hasUnsavedChanges:!1},billingInfo:{hasUnsavedChanges:!1}}),S=React.useCallback(()=>e?!1:b.publicInfo.hasUnsavedChanges||b.qualifications.hasUnsavedChanges||b.billingInfo.hasUnsavedChanges,[e,b]),R=React.useCallback((A,M)=>{_(I=>{var j;return((j=I[A])==null?void 0:j.hasUnsavedChanges)!==M.hasUnsavedChanges?(console.log(`Updating form state for ${A}:`,M.hasUnsavedChanges),{...I,[A]:M}):I})},[]),{NavigationGuardDialog:C}=useRouterNavigationGuard(S),E=o??d;return jsxRuntime.jsxs("div",{className:"@container",children:[g?jsxRuntime.jsx(Card,{className:"p-6",children:jsxRuntime.jsxs(Alert,{variant:"destructive",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Error"}),jsxRuntime.jsx(AlertDescription,{children:"There was an error loading your manufacturer information. Please try again later."})]})}):jsxRuntime.jsxs("div",{className:"space-y-6 mb-6",children:[jsxRuntime.jsx(SalesSummary,{fiscalYearMonthStart:E==null?void 0:E.FiscalYearMonthStart,salesData:E==null?void 0:E.SalesData,isLoading:f}),jsxRuntime.jsxs("div",{className:"grid @2xl:grid-cols-2 gap-6",children:[jsxRuntime.jsx(SalesChartCard,{statistics:(E==null?void 0:E.SalesStatistics)??[],loading:f}),jsxRuntime.jsx(ManufacturerResellerOrdersSection,{manufacturerId:(E==null?void 0:E.ManufacturerId)??"",activeOrders:(E==null?void 0:E.ActiveOrderDetails)??void 0,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerInventoryFinanceCard,{manufacturer:E,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerCreditFinanceCard,{manufacturer:E,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerReorderingCard,{manufacturer:E??{},onSave:()=>{},loading:f,readonly:e}),n&&jsxRuntime.jsx(ManufacturerPublicInfoSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("publicInfo",{hasUnsavedChanges:A})}),n&&jsxRuntime.jsx(OpenToWorkSection,{manufacturer:E,readonly:e,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerBillingInfoSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("billingInfo",{hasUnsavedChanges:A})}),n&&jsxRuntime.jsx(ManufacturerQualificationsSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("qualifications",{hasUnsavedChanges:A})})]}),n&&jsxRuntime.jsx(ManufacturerReportsSection,{manufacturerId:(E==null?void 0:E.ManufacturerId)??"",userEmail:l,isLoading:f})]}),jsxRuntime.jsx(C,{})]})}function ManufacturerCategories({categories:t,activeCategory:e,onSelectCategory:n}){return jsxRuntime.jsx("div",{className:"grid",children:jsxRuntime.jsx("div",{className:"flex overflow-x-auto small-scrollbar pb-4",children:jsxRuntime.jsx("div",{className:"flex gap-2",children:t.map(o=>jsxRuntime.jsxs(Button,{onClick:()=>n(o.CategoryCode??""),variant:e===o.CategoryCode?"default":"outline",size:"sm",className:"px-3 py-1.5 text-xs whitespace-nowrap rounded-full",children:[o.CategoryName??"Undefined",o.QualificationRequired&&jsxRuntime.jsx(ShieldCheck,{className:`ml-1 w-5 h-5 ${e!==o.CategoryCode?"text-red-500":""}`})]},o.CategoryCode))})})})}function ManufacturerProducts({applicationId:t,manufacturer:e,shopifyHostName:n}){var I,j,q,z;const[o]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeShopifyMutation(),[l,d]=React.useState(((j=(I=e.Categories)==null?void 0:I[0])==null?void 0:j.CategoryCode)||""),[f,g]=React.useState(!1),[b,_]=React.useState(!1),{toast:S}=useToast(),{data:R,isLoading:C,isFetching:E}=useGetV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeQuery({routeResellerId:t,manufacturerId:e.ManufacturerId,categoryCode:l??""},{skip:!e.ManufacturerId||!l}),A=async()=>{try{g(!0),_(!1),await o({routeResellerId:t,manufacturerId:e.ManufacturerId??"",categoryCode:l,shopifyHostName:n}).unwrap()&&S({title:"Success",description:"Category synced to Shopify successfully",variant:"success"})}catch(Q){console.error("Error syncing to Shopify:",Q),S({title:"Error",description:"Error syncing category to Shopify.",variant:"destructive"})}finally{g(!1)}},M=()=>{var Q,F;return((F=(Q=e.Categories)==null?void 0:Q.find(V=>V.CategoryCode===l))==null?void 0:F.CategoryName)||l};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(ManufacturerCategories,{categories:e.Categories||[],activeCategory:l,onSelectCategory:d}),n&&((q=e.Categories)==null?void 0:q.findIndex(Q=>Q.AvailableToBuy))!==-1&&jsxRuntime.jsxs(Dialog,{open:b,onOpenChange:_,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700 mb-4",disabled:f,children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2 h-4 w-4"}),"Sync Category to Shopify"]})})}),jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Confirm Sync to Shopify"}),jsxRuntime.jsxs(DialogDescription,{children:['Are you sure you want to sync the category "',M(),'" to Shopify? This will add all products in this category to your Shopify store.']})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>_(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",onClick:A,disabled:f,children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):"Confirm Sync"})]})]})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4 mb-4",children:C||E?Array.from({length:4}).map((Q,F)=>jsxRuntime.jsx(ProductCard,{},F)):R!=null&&R.Products&&(R==null?void 0:R.Products.length)>0?(z=[...R.Products].sort((Q,F)=>{const V=Q.OverallPercentileRank??0;return(F.OverallPercentileRank??0)-V}))==null?void 0:z.map(Q=>jsxRuntime.jsx(ProductCard,{applicationId:t,product:Q,viewProductLink:`/${t}/Product/${Q.RandmarSKU}`,shopifyHostname:n},Q.RandmarSKU)):jsxRuntime.jsxs(Alert,{variant:"warning",className:"col-span-1 @md:col-span-2",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Warning"}),jsxRuntime.jsx(AlertDescription,{children:"No products found for this manufacturer category."})]})})]})}function PartnerRelationshipPage({applicationId:t,partnerId:e,userEmail:n,shopifyHostName:o,isSuperAdmin:l}){var j,q,z;const{data:d,isLoading:f,isFetching:g}=useGetV4PartnerByRouteApplicationIdPartnerAndPartnerIdQuery({routeApplicationId:t,partnerId:e,withSpecification:!0}),b=f||g,{toast:_}=useToast(),[S]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdShopifyMutation(),[R,C]=React.useState(!1),[E,A]=React.useState(!1),M=async()=>{try{C(!0),A(!1),await S({routeResellerId:t??"",manufacturerId:e??"",shopifyHostName:o}).unwrap()&&_({title:"Success",description:"Manufacturer synced to Shopify successfully",variant:"success"})}catch(Q){console.error("Error syncing to Shopify:",Q),_({title:"Error",description:"Error syncing manufacturer to Shopify.",variant:"destructive"})}finally{C(!1)}},I=()=>d!=null&&d.Reseller?"reseller-overview":d!=null&&d.Manufacturer?"manufacturer-overview":"";return jsxRuntime.jsxs("div",{className:"@container",children:[jsxRuntime.jsxs("div",{className:"grid gap-4 @2xl:grid-cols-2",children:[jsxRuntime.jsx(PartnerCard,{account:d,loading:b,withAbout:!0,withVoice:!1,action:" "}),jsxRuntime.jsxs("div",{className:"grid gap-4",children:[((d==null?void 0:d.Manufacturer)||b)&&jsxRuntime.jsx(ManufacturerCard,{manufacturer:d==null?void 0:d.Manufacturer,loading:b,mainAction:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(ManufacturerGetStartedButton,{applicationId:t,manufacturer:d==null?void 0:d.Manufacturer}),o&&((q=(j=d==null?void 0:d.Manufacturer)==null?void 0:j.Categories)==null?void 0:q.findIndex(Q=>Q.AvailableToBuy))!==-1&&jsxRuntime.jsxs(Dialog,{open:E,onOpenChange:A,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700 ml-2",disabled:R,children:R?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2 h-4 w-4"}),"Sync Manufacturer to Shopify"]})})}),jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Confirm Sync to Shopify"}),jsxRuntime.jsxs(DialogDescription,{children:['Are you sure you want to sync the manufacturer "',(z=d==null?void 0:d.Manufacturer)==null?void 0:z.PublicName,'" to Shopify? This will add all products from this manufacturer to your Shopify store.']})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>A(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",onClick:M,disabled:R,children:R?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):"Confirm Sync"})]})]})]})]})}),(d==null?void 0:d.Reseller)&&jsxRuntime.jsx(ResellerCard,{reseller:d==null?void 0:d.Reseller,loading:b})]})]}),((d==null?void 0:d.Reseller)||(d==null?void 0:d.Manufacturer))&&!b&&jsxRuntime.jsx("div",{className:"max-w-6xl mx-auto p-4",children:jsxRuntime.jsxs(Tabs,{defaultValue:I(),className:"w-full",children:[jsxRuntime.jsxs(TabsList,{className:"inline-flex h-auto items-center justify-center rounded-none border-b bg-transparent p-0",children:[(d==null?void 0:d.Reseller)&&jsxRuntime.jsx(TabsTrigger,{value:"reseller-overview",className:"reseller-theme relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Reseller Overview"}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsTrigger,{value:"manufacturer-overview",className:"manufacturer-theme relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Manufacturer Overview"}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsTrigger,{value:"products",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Products"})]}),(d==null?void 0:d.Reseller)&&jsxRuntime.jsx(TabsContent,{value:"reseller-overview",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ResellerOverview,{readonly:!0,appID:d.ApplicationId||"",reseller:d==null?void 0:d.Reseller,userEmail:n,isSuperAdmin:l,withoutReports:!0})})}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsContent,{value:"manufacturer-overview",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ManufacturerOverviewPage,{readonly:!0,manufacturer:d==null?void 0:d.Manufacturer,applicationId:t,userEmail:n})})}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsContent,{value:"products",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ManufacturerProducts,{applicationId:t,manufacturer:d.Manufacturer,shopifyHostName:o})})})]})}),b&&jsxRuntime.jsx("div",{className:"max-w-6xl mx-auto p-4 mt-4 flex justify-center items-center h-32",children:jsxRuntime.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin text-primary"})})]})}const PublicInfo=({reseller:t,appID:e,isLoading:n,readonly:o,onUnsavedChanges:l})=>{const{toast:d}=useToast(),[f]=usePostV4PartnerByApplicationIdAccountResellerAndFieldNameMutation(),[g,b]=React.useState({}),_=React.useMemo(()=>({publicEmail:t.PublicEmail??"",contactName:t.ContactName??"",phone:t.Phone??"",website:t.Website??""}),[t]),{register:S,handleSubmit:R,reset:C,watch:E,formState:{errors:A,isSubmitting:M}}=useForm({defaultValues:_}),I=E(),j=React.useCallback(()=>g?JSON.stringify(I)!==JSON.stringify(g):!1,[I,g]);React.useEffect(()=>{l&&l(j())},[j,l]),React.useEffect(()=>{t&&Object.keys(t).length>0&&(C(_),b(_))},[t,C,_]);const q=async Q=>{let F=!0,V=!1;const te=Object.keys(Q).map(ne=>({key:ne,keyApi:ne.charAt(0).toUpperCase()+ne.slice(1)}));for(const ne of te){const se=Q[ne.key],ge=t[ne.keyApi];if(se!==ge&&se!==void 0){V=!0;try{await f({applicationId:e,fieldName:ne.keyApi,newValue:String(se)}).unwrap()||(F=!1)}catch(oe){console.error(`Error updating ${ne.keyApi}:`,oe),F=!1}}}F&&V?(d({title:"Public info",description:"Information updated successfully",variant:"success"}),b({...Q}),l&&l(!1)):F||d({title:"Updation error",description:"Failed to update",variant:"destructive"})},z=Q=>!Q||Q.trim()==="";return n?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Public Information"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-28"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"})})]})})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsxs(CardTitle,{className:"text-1xl font-bold",children:["Public Information ",o?"(read only)":""]})}),jsxRuntime.jsxs(CardContent,{children:[(z(E("contactName"))||z(E("publicEmail"))||z(E("website"))||z(E("phone")))&&jsxRuntime.jsxs(Alert,{variant:"destructive",className:"mb-6",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Missing information"}),jsxRuntime.jsx(AlertDescription,{children:"All fields are required to get started at working with Manufacturers."})]}),jsxRuntime.jsxs("form",{onSubmit:R(q),className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-sm font-medium leading-none",htmlFor:"contactName",children:"Main Representative *"}),jsxRuntime.jsx(Input,{id:"contactName",placeholder:"John Doe",readOnly:o,...S("contactName",{}),className:A.contactName||z(E("contactName"))?"input-error-indicator":""}),A.contactName&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:A.contactName.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-sm font-medium leading-none",htmlFor:"publicEmail",children:"Public Email *"}),jsxRuntime.jsx(Input,{id:"publicEmail",placeholder:"contact@company.com",readOnly:o,...S("publicEmail",{pattern:{value:/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,message:"Invalid email address"}}),className:A.publicEmail||z(E("publicEmail"))?"input-error-indicator":""}),A.publicEmail&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:A.publicEmail.message})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-sm font-medium leading-none",htmlFor:"website",children:"Website *"}),jsxRuntime.jsx(Input,{id:"website",placeholder:"https://company.com",readOnly:o,...S("website",{pattern:{value:/^.{7,}$/,message:"Must be at least 7 characters"}}),className:A.website||z(E("website"))?"input-error-indicator":""}),A.website&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:A.website.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-sm font-medium leading-none",htmlFor:"phone",children:"Phone Number *"}),jsxRuntime.jsx(Input,{id:"phone",placeholder:"+1 (555) 123-4567",readOnly:o,...S("phone",{pattern:{value:/^.{7,}$/,message:"Must be at least 7 characters"}}),className:A.phone||z(E("phone"))?"input-error-indicator":""}),A.phone&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:A.phone.message})]}),jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Button,{type:"submit",disabled:M||o,className:o?"hidden":"",children:M?"Saving...":"Save"})})]})]})]})};function BillingCard({appID:t,reseller:e,isLoading:n,withoutReports:o,userEmail:l}){const{toast:d}=useToast(),{Statement:f,CreditLimit:g}=e,[b,_]=React.useState(!1),[S,R]=React.useState(!1),[C,E]=React.useState(!1),[A,M]=React.useState(!1),[I,j]=React.useState(!1),[q,z]=React.useState(l||""),Q=[{label:"0 - 30 Days",value:jsxRuntime.jsx(FormattedNumber,{value:(f==null?void 0:f.Over0)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:Calendar},{label:"31 - 45 Days",value:jsxRuntime.jsx(FormattedNumber,{value:(f==null?void 0:f.Over30)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:CalendarDays},{label:"45+ Days",value:jsxRuntime.jsx(FormattedNumber,{value:(f==null?void 0:f.Over45)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:CalendarRange},{label:"Total",value:jsxRuntime.jsx(FormattedNumber,{value:(f==null?void 0:f.Total)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:DollarSign},{label:"Credit Limit",value:jsxRuntime.jsx(FormattedNumber,{value:g||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:CreditCard}],[F]=useLazyGetV4ResellerByRouteResellerIdDocumentAndDocumentNumberPdfQuery(),V=async ge=>{_(!1),ge?R(!0):E(!0);let oe="";try{const je=(await F({routeResellerId:t,documentNumber:`ST${t}`})).data;if(!je.url||!je.filename)throw new Error("No data received for download.");if(oe=je.url,ge)window.open(oe);else{const Ne=document.createElement("a");Ne.href=oe,Ne.download=je.filename,document.body.appendChild(Ne),Ne.click(),Ne.remove()}d({title:"Success",description:"Statement downloaded successfully.",variant:"success"})}catch(Ae){console.error("Download Error:",Ae),d({title:"Error",description:"An error occurred while downloading the statement. Please try again.",variant:"destructive"})}finally{ge?R(!1):E(!1),oe&&setTimeout(()=>{window.URL.revokeObjectURL(oe)},1e3)}},[te]=usePostV4ResellerByRouteResellerIdDocumentStatementEmailMutation(),ne=async()=>{if(!q||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(q)){d({title:"Invalid Email",description:"Please enter a valid email address.",variant:"destructive"});return}M(!0);try{await te({routeResellerId:t,emailAddress:q}).unwrap(),d({title:"Success",description:`Statement sent to ${q} successfully.`,variant:"success"}),j(!1)}catch(oe){console.error("Send Email Error:",oe),d({title:"Error",description:"An error occurred while sending the statement. Please try again.",variant:"destructive"})}finally{M(!1)}};if(n)return jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{className:"border-b p-6 md:p-5",children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-36"})}),jsxRuntime.jsxs(CardContent,{className:"p-6 md:p-5",children:[jsxRuntime.jsxs("div",{className:"grid sm:grid-cols-2 sm:divide-x divide-border",children:[jsxRuntime.jsx("div",{className:"space-y-6 sm:pe-4",children:[1,2,3].map(ge=>jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap gap-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 ms-auto"})]},ge))}),jsxRuntime.jsx("div",{className:"space-y-6 sm:ps-4 pt-6 sm:pt-0 mt-6 sm:mt-0 border-t sm:border-t-0 border-border",children:[1,2].map(ge=>jsxRuntime.jsx("div",{className:ge===2?"pt-6 mt-6 border-t border-border":"",children:jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap gap-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 ms-auto"})]})},ge))})]}),jsxRuntime.jsxs("div",{className:"flex justify-end mt-6 gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-28"})]})]})]});const se=!o;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{className:"border-b p-6 md:p-5",children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Billing Overview"})}),jsxRuntime.jsxs(CardContent,{className:"p-6 md:p-5",children:[jsxRuntime.jsxs("div",{className:"grid sm:grid-cols-2 sm:divide-x divide-border",children:[jsxRuntime.jsx("div",{className:"space-y-6 sm:pe-4",children:Q.slice(0,3).map((ge,oe)=>jsxRuntime.jsx(BillingItem,{icon:ge.icon,label:ge.label,value:ge.value},oe))}),jsxRuntime.jsx("div",{className:"space-y-6 sm:ps-4 pt-6 sm:pt-0 mt-6 sm:mt-0 border-t sm:border-t-0 border-border",children:Q.slice(3).map((ge,oe)=>jsxRuntime.jsx("div",{className:oe===1?"pt-6 mt-6 border-t border-border":"",children:jsxRuntime.jsx(BillingItem,{icon:ge.icon,label:ge.label,value:ge.value})},oe))})]}),se&&jsxRuntime.jsxs("div",{className:"flex justify-end mt-6 gap-2",children:[jsxRuntime.jsxs(DropdownMenu,{open:b,onOpenChange:_,children:[jsxRuntime.jsx(DropdownMenuTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"outline",disabled:S||C,children:S?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Printing..."]}):C?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Downloading..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(FileText,{className:"mr-2 h-4 w-4"}),"Statement",jsxRuntime.jsx(ChevronDown,{className:"ml-2 h-4 w-4"})]})})}),jsxRuntime.jsxs(DropdownMenuContent,{align:"end",children:[jsxRuntime.jsxs(DropdownMenuItem,{onClick:()=>V(!0),disabled:S,children:[jsxRuntime.jsx(Printer,{className:"mr-2 h-4 w-4"}),jsxRuntime.jsx("span",{children:"Print"})]}),jsxRuntime.jsx(DropdownMenuSeparator,{}),jsxRuntime.jsxs(DropdownMenuItem,{onClick:()=>V(!1),disabled:C,children:[jsxRuntime.jsx(Download,{className:"mr-2 h-4 w-4"}),jsxRuntime.jsx("span",{children:"Download"})]}),jsxRuntime.jsx(DropdownMenuSeparator,{}),jsxRuntime.jsxs(DropdownMenuItem,{onSelect:()=>j(!0),children:[jsxRuntime.jsx(Mail,{className:"mr-2 h-4 w-4"}),jsxRuntime.jsx("span",{children:"Send by Email"})]})]})]}),jsxRuntime.jsx(reactRouterDom.Link,{to:`https://dashboard.randmar.io/${t}/PayInvoice`,target:"_blank",children:jsxRuntime.jsxs(Button,{children:[jsxRuntime.jsx(CreditCard,{className:"mr-2 h-4 w-4"}),"Pay Invoices"]})})]})]})]}),jsxRuntime.jsx(Dialog,{open:I,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Send Statement by Email"}),jsxRuntime.jsx(DialogDescription,{children:"Enter the recipient's email address below. The statement will be sent as a PDF attachment."})]}),jsxRuntime.jsx("div",{className:"grid gap-4 py-4",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",className:"text-right",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",type:"email",value:q,onChange:ge=>z(ge.target.value),className:"col-span-3",placeholder:"recipient@example.com"})]})}),jsxRuntime.jsx(DialogFooter,{children:jsxRuntime.jsx(Button,{type:"submit",onClick:ne,disabled:A||!q,children:A?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Send,{className:"mr-2 h-4 w-4"}),"Send"]})})})]})})]})}function BillingItem({icon:t,label:e,value:n}){return jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap gap-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(t,{className:"size-4 text-muted-foreground"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:e})]}),jsxRuntime.jsx("span",{className:"text-base font-semibold ms-auto",children:n})]})}function ChangePricingTierModal({open:t,setOpen:e,tier:n,onTierChange:o,isLoading:l}){const d=()=>{e(!1)};return jsxRuntime.jsx(Dialog,{open:t,onOpenChange:e,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsx(DialogTitle,{children:"Change Pricing Tier"})}),jsxRuntime.jsxs("div",{className:"grid gap-1.5 py-2",children:[jsxRuntime.jsxs("p",{className:"text-lg text-muted-foreground",children:["Requested Pricing Tier: ",jsxRuntime.jsx("span",{className:"font-bold",children:n})]}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"If your account qualifies, your pricing will update immediately."}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"If not, we'll review your request and notify you of the decision."})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:d,disabled:l,children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:o,disabled:l,children:l?"Loading...":`Apply for ${n}`})]})]})})}const getPricingText=t=>t===1?"The Best":t===2?"Fixed 12.5% GP on all items":t===3?"Advantageous":t===4?"Buying Group":t===5?"Cost":t,getShippingText=t=>t==="A"?"Free or Custom":t==="B"?"Fixed $10 anywhere":t==="C"?`Free shipping on $150+ orders to your location,
1077
+ Defaulting to \`null\`.`}var Root=Progress$1,Indicator=ProgressIndicator;const Progress=React__namespace.forwardRef(({className:t,value:e,...n},o)=>jsxRuntime.jsx(Root,{ref:o,className:cn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...n,children:jsxRuntime.jsx(Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));Progress.displayName=Root.displayName;function ManufacturerInventoryFinanceCard({manufacturer:t,isLoading:e}){const{data:n,isLoading:o,isFetching:l}=useGetV4ManufacturerByRouteManufacturerIdInventoryValueQuery({routeManufacturerId:(t==null?void 0:t.ManufacturerId)??""},{skip:!(t!=null&&t.ManufacturerId)}),d=(t==null?void 0:t.DefaultMaxInventoryValue)??0,f=(n||[]).reduce((_,S)=>_+(S.InventoryValue||0),0),g=d-f,b=Math.round(f/d*100);return e||o||l?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/2 mt-2"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-2 w-full"})]})]})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(DollarSign,{className:"h-5 w-5 text-muted-foreground"}),"Inventory Finance"]}),jsxRuntime.jsx(CardDescription,{children:"Current inventory financial status"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Max Allowance"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(d)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Current Funds"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(f)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Available Funds"}),jsxRuntime.jsx("span",{className:`font-bold ${g>=0?"text-emerald-600 dark:text-emerald-500":"text-red-600 dark:text-red-500"}`,children:formatMoney(g)})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Budget Usage"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:[b,"%"]}),b>80&&jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4 text-amber-500"})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:b>80?"High usage alert":"Budget usage"})})]})})]}),jsxRuntime.jsx(Progress,{value:b,className:"h-2"})]})]})]})}function ManufacturerCreditFinanceCard({manufacturer:t,isLoading:e}){const n=(t==null?void 0:t.CreditLimit)??0,o=(t==null?void 0:t.OutstandingBalance)??0,l=n-o,d=Math.round(o/n*100);return e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/2 mt-2"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-2 w-full"})]})]})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(CreditCard,{className:"h-5 w-5 text-muted-foreground"}),"Credit Finance"]}),jsxRuntime.jsx(CardDescription,{children:"Current credit financial status"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Credit Limit"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(n)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Outstanding Balance"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(o)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Available Credit"}),jsxRuntime.jsx("span",{className:`font-bold ${l>=0?"text-emerald-600 dark:text-emerald-500":"text-red-600 dark:text-red-500"}`,children:formatMoney(l)})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Credit Usage"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:[d,"%"]}),d>80&&jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4 text-amber-500"})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:d>80?"High credit usage alert":"Credit usage"})})]})})]}),jsxRuntime.jsx(Progress,{value:d,className:"h-2"})]})]})]})}function SalesChartCard({statistics:t,loading:e=!1,mode:n="month",chartHeight:o=300,className:l,size:d="default"}){return e?jsxRuntime.jsxs(Card,{className:cn("w-full",l),children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-48 rounded-md"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{style:{height:o},children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full rounded-md"})}),d==="default"&&n==="month"&&jsxRuntime.jsxs("div",{className:"mt-4 flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40 rounded-md"})]})]})]}):jsxRuntime.jsxs(Card,{className:cn("w-full",l),children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:n==="week"?"Weekly Sales Performance":"Monthly Sales Performance"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(SalesChart,{statistics:t,mode:n,chartHeight:o,size:d})})]})}function ManufacturerOverviewPage({applicationId:t,readonly:e,withReports:n,manufacturer:o,userEmail:l}){const{data:d,isLoading:f,isError:g}=useGetV4PartnerByApplicationIdAccountManufacturerQuery({applicationId:t,withSpecification:!0},{skip:!!o}),[b,_]=React.useState({publicInfo:{hasUnsavedChanges:!1},qualifications:{hasUnsavedChanges:!1},billingInfo:{hasUnsavedChanges:!1}}),S=React.useCallback(()=>e?!1:b.publicInfo.hasUnsavedChanges||b.qualifications.hasUnsavedChanges||b.billingInfo.hasUnsavedChanges,[e,b]),R=React.useCallback((A,M)=>{_(I=>{var j;return((j=I[A])==null?void 0:j.hasUnsavedChanges)!==M.hasUnsavedChanges?(console.log(`Updating form state for ${A}:`,M.hasUnsavedChanges),{...I,[A]:M}):I})},[]),{NavigationGuardDialog:C}=useRouterNavigationGuard(S),E=o??d;return jsxRuntime.jsxs("div",{className:"@container",children:[g?jsxRuntime.jsx(Card,{className:"p-6",children:jsxRuntime.jsxs(Alert,{variant:"destructive",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Error"}),jsxRuntime.jsx(AlertDescription,{children:"There was an error loading your manufacturer information. Please try again later."})]})}):jsxRuntime.jsxs("div",{className:"space-y-6 mb-6",children:[jsxRuntime.jsx(SalesSummary,{fiscalYearMonthStart:E==null?void 0:E.FiscalYearMonthStart,salesData:E==null?void 0:E.SalesData,isLoading:f}),jsxRuntime.jsxs("div",{className:"grid @2xl:grid-cols-2 gap-6",children:[jsxRuntime.jsx(SalesChartCard,{statistics:(E==null?void 0:E.SalesStatistics)??[],loading:f}),jsxRuntime.jsx(ManufacturerResellerOrdersSection,{manufacturerId:(E==null?void 0:E.ManufacturerId)??"",activeOrders:(E==null?void 0:E.ActiveOrderDetails)??void 0,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerInventoryFinanceCard,{manufacturer:E,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerCreditFinanceCard,{manufacturer:E,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerReorderingCard,{manufacturer:E??{},onSave:()=>{},loading:f,readonly:e}),n&&jsxRuntime.jsx(ManufacturerPublicInfoSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("publicInfo",{hasUnsavedChanges:A})}),n&&jsxRuntime.jsx(OpenToWorkSection,{manufacturer:E,readonly:e,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerBillingInfoSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("billingInfo",{hasUnsavedChanges:A})}),n&&jsxRuntime.jsx(ManufacturerQualificationsSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("qualifications",{hasUnsavedChanges:A})})]}),n&&jsxRuntime.jsx(ManufacturerReportsSection,{manufacturerId:(E==null?void 0:E.ManufacturerId)??"",userEmail:l,isLoading:f})]}),jsxRuntime.jsx(C,{})]})}function ManufacturerCategories({categories:t,activeCategory:e,onSelectCategory:n}){return jsxRuntime.jsx("div",{className:"grid",children:jsxRuntime.jsx("div",{className:"flex overflow-x-auto small-scrollbar pb-4",children:jsxRuntime.jsx("div",{className:"flex gap-2",children:t.map(o=>jsxRuntime.jsxs(Button,{onClick:()=>n(o.CategoryCode??""),variant:e===o.CategoryCode?"default":"outline",size:"sm",className:"px-3 py-1.5 text-xs whitespace-nowrap rounded-full",children:[o.CategoryName??"Undefined",o.QualificationRequired&&jsxRuntime.jsx(ShieldCheck,{className:`ml-1 w-5 h-5 ${e!==o.CategoryCode?"text-red-500":""}`})]},o.CategoryCode))})})})}function ManufacturerProducts({applicationId:t,manufacturer:e,shopifyHostName:n}){var I,j,q,z;const[o]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeShopifyMutation(),[l,d]=React.useState(((j=(I=e.Categories)==null?void 0:I[0])==null?void 0:j.CategoryCode)||""),[f,g]=React.useState(!1),[b,_]=React.useState(!1),{toast:S}=useToast(),{data:R,isLoading:C,isFetching:E}=useGetV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeQuery({routeResellerId:t,manufacturerId:e.ManufacturerId,categoryCode:l??""},{skip:!e.ManufacturerId||!l}),A=async()=>{try{g(!0),_(!1),await o({routeResellerId:t,manufacturerId:e.ManufacturerId??"",categoryCode:l,shopifyHostName:n}).unwrap()&&S({title:"Success",description:"Category synced to Shopify successfully",variant:"success"})}catch(Q){console.error("Error syncing to Shopify:",Q),S({title:"Error",description:"Error syncing category to Shopify.",variant:"destructive"})}finally{g(!1)}},M=()=>{var Q,F;return((F=(Q=e.Categories)==null?void 0:Q.find(V=>V.CategoryCode===l))==null?void 0:F.CategoryName)||l};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(ManufacturerCategories,{categories:e.Categories||[],activeCategory:l,onSelectCategory:d}),n&&((q=e.Categories)==null?void 0:q.findIndex(Q=>Q.AvailableToBuy))!==-1&&jsxRuntime.jsxs(Dialog,{open:b,onOpenChange:_,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700 mb-4",disabled:f,children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2 h-4 w-4"}),"Sync Category to Shopify"]})})}),jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Confirm Sync to Shopify"}),jsxRuntime.jsxs(DialogDescription,{children:['Are you sure you want to sync the category "',M(),'" to Shopify? This will add all products in this category to your Shopify store.']})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>_(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",onClick:A,disabled:f,children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):"Confirm Sync"})]})]})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4 mb-4",children:C||E?Array.from({length:4}).map((Q,F)=>jsxRuntime.jsx(ProductCard,{},F)):R!=null&&R.Products&&(R==null?void 0:R.Products.length)>0?(z=[...R.Products].sort((Q,F)=>{const V=Q.OverallPercentileRank??0;return(F.OverallPercentileRank??0)-V}))==null?void 0:z.map(Q=>jsxRuntime.jsx(ProductCard,{applicationId:t,product:Q,viewProductLink:`/${t}/Product/${Q.RandmarSKU}`,shopifyHostname:n},Q.RandmarSKU)):jsxRuntime.jsxs(Alert,{variant:"warning",className:"col-span-1 @md:col-span-2",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Warning"}),jsxRuntime.jsx(AlertDescription,{children:"No products found for this manufacturer category."})]})})]})}function PartnerRelationshipPage({applicationId:t,partnerId:e,userEmail:n,shopifyHostName:o,isSuperAdmin:l}){var j,q,z;const{data:d,isLoading:f,isFetching:g}=useGetV4PartnerByRouteApplicationIdPartnerAndPartnerIdQuery({routeApplicationId:t,partnerId:e,withSpecification:!0}),b=f||g,{toast:_}=useToast(),[S]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdShopifyMutation(),[R,C]=React.useState(!1),[E,A]=React.useState(!1),M=async()=>{try{C(!0),A(!1),await S({routeResellerId:t??"",manufacturerId:e??"",shopifyHostName:o}).unwrap()&&_({title:"Success",description:"Manufacturer synced to Shopify successfully",variant:"success"})}catch(Q){console.error("Error syncing to Shopify:",Q),_({title:"Error",description:"Error syncing manufacturer to Shopify.",variant:"destructive"})}finally{C(!1)}},I=()=>d!=null&&d.Reseller?"reseller-overview":d!=null&&d.Manufacturer?"manufacturer-overview":"";return jsxRuntime.jsxs("div",{className:"@container",children:[jsxRuntime.jsxs("div",{className:"grid gap-4 @2xl:grid-cols-2",children:[jsxRuntime.jsx(PartnerCard,{account:d,loading:b,withAbout:!0,withVoice:!1,action:" "}),jsxRuntime.jsxs("div",{className:"grid gap-4",children:[((d==null?void 0:d.Manufacturer)||b)&&jsxRuntime.jsx(ManufacturerCard,{manufacturer:d==null?void 0:d.Manufacturer,loading:b,mainAction:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(ManufacturerGetStartedButton,{applicationId:t,manufacturer:d==null?void 0:d.Manufacturer}),o&&((q=(j=d==null?void 0:d.Manufacturer)==null?void 0:j.Categories)==null?void 0:q.findIndex(Q=>Q.AvailableToBuy))!==-1&&jsxRuntime.jsxs(Dialog,{open:E,onOpenChange:A,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700 ml-2",disabled:R,children:R?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2 h-4 w-4"}),"Sync Manufacturer to Shopify"]})})}),jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Confirm Sync to Shopify"}),jsxRuntime.jsxs(DialogDescription,{children:['Are you sure you want to sync the manufacturer "',(z=d==null?void 0:d.Manufacturer)==null?void 0:z.PublicName,'" to Shopify? This will add all products from this manufacturer to your Shopify store.']})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>A(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",onClick:M,disabled:R,children:R?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):"Confirm Sync"})]})]})]})]})}),(d==null?void 0:d.Reseller)&&jsxRuntime.jsx(ResellerCard,{reseller:d==null?void 0:d.Reseller,loading:b})]})]}),((d==null?void 0:d.Reseller)||(d==null?void 0:d.Manufacturer))&&!b&&jsxRuntime.jsx("div",{className:"max-w-6xl mx-auto p-4",children:jsxRuntime.jsxs(Tabs,{defaultValue:I(),className:"w-full",children:[jsxRuntime.jsxs(TabsList,{className:"inline-flex h-auto items-center justify-center rounded-none border-b bg-transparent p-0",children:[(d==null?void 0:d.Reseller)&&jsxRuntime.jsx(TabsTrigger,{value:"reseller-overview",className:"reseller-theme relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Reseller Overview"}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsTrigger,{value:"manufacturer-overview",className:"manufacturer-theme relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Manufacturer Overview"}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsTrigger,{value:"products",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Products"})]}),(d==null?void 0:d.Reseller)&&jsxRuntime.jsx(TabsContent,{value:"reseller-overview",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ResellerOverview,{readonly:!0,appID:d.ApplicationId||"",reseller:d==null?void 0:d.Reseller,userEmail:n,isSuperAdmin:l,withoutReports:!0})})}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsContent,{value:"manufacturer-overview",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ManufacturerOverviewPage,{readonly:!0,manufacturer:d==null?void 0:d.Manufacturer,applicationId:t,userEmail:n})})}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsContent,{value:"products",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ManufacturerProducts,{applicationId:t,manufacturer:d.Manufacturer,shopifyHostName:o})})})]})}),b&&jsxRuntime.jsx("div",{className:"max-w-6xl mx-auto p-4 mt-4 flex justify-center items-center h-32",children:jsxRuntime.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin text-primary"})})]})}const PublicInfo=({reseller:t,appID:e,isLoading:n,readonly:o,onUnsavedChanges:l})=>{const{toast:d}=useToast(),[f]=usePostV4PartnerByApplicationIdAccountResellerAndFieldNameMutation(),[g,b]=React.useState({}),_=React.useMemo(()=>({publicEmail:t.PublicEmail??"",contactName:t.ContactName??"",phone:t.Phone??"",website:t.Website??""}),[t]),{register:S,handleSubmit:R,reset:C,watch:E,formState:{errors:A,isSubmitting:M}}=useForm({defaultValues:_}),I=E(),j=React.useCallback(()=>g?JSON.stringify(I)!==JSON.stringify(g):!1,[I,g]);React.useEffect(()=>{l&&l(j())},[j,l]),React.useEffect(()=>{t&&Object.keys(t).length>0&&(C(_),b(_))},[t,C,_]);const q=async Q=>{let F=!0,V=!1;const te=Object.keys(Q).map(ne=>({key:ne,keyApi:ne.charAt(0).toUpperCase()+ne.slice(1)}));for(const ne of te){const se=Q[ne.key],ge=t[ne.keyApi];if(se!==ge&&se!==void 0){V=!0;try{await f({applicationId:e,fieldName:ne.keyApi,newValue:String(se)}).unwrap()||(F=!1)}catch(oe){console.error(`Error updating ${ne.keyApi}:`,oe),F=!1}}}F&&V?(d({title:"Public info",description:"Information updated successfully",variant:"success"}),b({...Q}),l&&l(!1)):F||d({title:"Updation error",description:"Failed to update",variant:"destructive"})},z=Q=>!Q||Q.trim()==="";return n?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Public Information"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-28"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"})})]})})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsxs(CardTitle,{className:"text-1xl font-bold",children:["Public Information ",o?"(read only)":""]})}),jsxRuntime.jsxs(CardContent,{children:[(z(E("contactName"))||z(E("publicEmail"))||z(E("website"))||z(E("phone")))&&jsxRuntime.jsxs(Alert,{variant:"destructive",className:"mb-6",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Missing information"}),jsxRuntime.jsx(AlertDescription,{children:"All fields are required to get started at working with Manufacturers."})]}),jsxRuntime.jsxs("form",{onSubmit:R(q),className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-sm font-medium leading-none",htmlFor:"contactName",children:"Main Representative *"}),jsxRuntime.jsx(Input,{id:"contactName",placeholder:"John Doe",readOnly:o,...S("contactName",{}),className:A.contactName||z(E("contactName"))?"input-error-indicator":""}),A.contactName&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:A.contactName.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-sm font-medium leading-none",htmlFor:"publicEmail",children:"Public Email *"}),jsxRuntime.jsx(Input,{id:"publicEmail",placeholder:"contact@company.com",readOnly:o,...S("publicEmail",{pattern:{value:/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,message:"Invalid email address"}}),className:A.publicEmail||z(E("publicEmail"))?"input-error-indicator":""}),A.publicEmail&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:A.publicEmail.message})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-sm font-medium leading-none",htmlFor:"website",children:"Website *"}),jsxRuntime.jsx(Input,{id:"website",placeholder:"https://company.com",readOnly:o,...S("website",{pattern:{value:/^.{7,}$/,message:"Must be at least 7 characters"}}),className:A.website||z(E("website"))?"input-error-indicator":""}),A.website&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:A.website.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-sm font-medium leading-none",htmlFor:"phone",children:"Phone Number *"}),jsxRuntime.jsx(Input,{id:"phone",placeholder:"+1 (555) 123-4567",readOnly:o,...S("phone",{pattern:{value:/^.{7,}$/,message:"Must be at least 7 characters"}}),className:A.phone||z(E("phone"))?"input-error-indicator":""}),A.phone&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:A.phone.message})]}),jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Button,{type:"submit",disabled:M||o,className:o?"hidden":"",children:M?"Saving...":"Save"})})]})]})]})};function BillingCard({appID:t,reseller:e,isLoading:n,withoutReports:o,userEmail:l}){const{toast:d}=useToast(),{Statement:f,CreditLimit:g}=e,[b,_]=React.useState(!1),[S,R]=React.useState(!1),[C,E]=React.useState(!1),[A,M]=React.useState(!1),[I,j]=React.useState(!1),[q,z]=React.useState(l||""),Q=[{label:"0 - 30 Days",value:jsxRuntime.jsx(FormattedNumber,{value:(f==null?void 0:f.Over0)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:Calendar},{label:"31 - 45 Days",value:jsxRuntime.jsx(FormattedNumber,{value:(f==null?void 0:f.Over30)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:CalendarDays},{label:"45+ Days",value:jsxRuntime.jsx(FormattedNumber,{value:(f==null?void 0:f.Over45)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:CalendarRange},{label:"Total",value:jsxRuntime.jsx(FormattedNumber,{value:(f==null?void 0:f.Total)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:DollarSign},{label:"Credit Limit",value:jsxRuntime.jsx(FormattedNumber,{value:g||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:CreditCard}],[F]=useLazyGetV4ResellerByRouteResellerIdDocumentAndDocumentNumberPdfQuery(),V=async ge=>{_(!1),ge?R(!0):E(!0);let oe="";try{const je=(await F({routeResellerId:t,documentNumber:`ST${t}`})).data;if(!je.url||!je.filename)throw new Error("No data received for download.");if(oe=je.url,ge)window.open(oe);else{const Ne=document.createElement("a");Ne.href=oe,Ne.download=je.filename,document.body.appendChild(Ne),Ne.click(),Ne.remove()}d({title:"Success",description:"Statement downloaded successfully.",variant:"success"})}catch(Ae){console.error("Download Error:",Ae),d({title:"Error",description:"An error occurred while downloading the statement. Please try again.",variant:"destructive"})}finally{ge?R(!1):E(!1),oe&&setTimeout(()=>{window.URL.revokeObjectURL(oe)},1e3)}},[te]=usePostV4ResellerByRouteResellerIdDocumentStatementEmailMutation(),ne=async()=>{if(!q||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(q)){d({title:"Invalid Email",description:"Please enter a valid email address.",variant:"destructive"});return}M(!0);try{await te({routeResellerId:t,emailAddress:q}).unwrap(),d({title:"Success",description:`Statement sent to ${q} successfully.`,variant:"success"}),j(!1)}catch(oe){console.error("Send Email Error:",oe),d({title:"Error",description:"An error occurred while sending the statement. Please try again.",variant:"destructive"})}finally{M(!1)}};if(n)return jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{className:"border-b p-6 md:p-5",children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-36"})}),jsxRuntime.jsxs(CardContent,{className:"p-6 md:p-5",children:[jsxRuntime.jsxs("div",{className:"grid sm:grid-cols-2 sm:divide-x divide-border",children:[jsxRuntime.jsx("div",{className:"space-y-6 sm:pe-4",children:[1,2,3].map(ge=>jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap gap-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 ms-auto"})]},ge))}),jsxRuntime.jsx("div",{className:"space-y-6 sm:ps-4 pt-6 sm:pt-0 mt-6 sm:mt-0 border-t sm:border-t-0 border-border",children:[1,2].map(ge=>jsxRuntime.jsx("div",{className:ge===2?"pt-6 mt-6 border-t border-border":"",children:jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap gap-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 ms-auto"})]})},ge))})]}),jsxRuntime.jsxs("div",{className:"flex justify-end mt-6 gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-28"})]})]})]});const se=!o;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{className:"border-b p-6 md:p-5",children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Billing Overview"})}),jsxRuntime.jsxs(CardContent,{className:"p-6 md:p-5",children:[jsxRuntime.jsxs("div",{className:"grid sm:grid-cols-2 sm:divide-x divide-border",children:[jsxRuntime.jsx("div",{className:"space-y-6 sm:pe-4",children:Q.slice(0,3).map((ge,oe)=>jsxRuntime.jsx(BillingItem,{icon:ge.icon,label:ge.label,value:ge.value},oe))}),jsxRuntime.jsx("div",{className:"space-y-6 sm:ps-4 pt-6 sm:pt-0 mt-6 sm:mt-0 border-t sm:border-t-0 border-border",children:Q.slice(3).map((ge,oe)=>jsxRuntime.jsx("div",{className:oe===1?"pt-6 mt-6 border-t border-border":"",children:jsxRuntime.jsx(BillingItem,{icon:ge.icon,label:ge.label,value:ge.value})},oe))})]}),se&&jsxRuntime.jsxs("div",{className:"flex justify-end mt-6 gap-2",children:[jsxRuntime.jsxs(DropdownMenu,{open:b,onOpenChange:_,children:[jsxRuntime.jsx(DropdownMenuTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"outline",disabled:S||C,children:S?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Printing..."]}):C?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Downloading..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(FileText,{className:"mr-2 h-4 w-4"}),"Statement",jsxRuntime.jsx(ChevronDown,{className:"ml-2 h-4 w-4"})]})})}),jsxRuntime.jsxs(DropdownMenuContent,{align:"end",children:[jsxRuntime.jsxs(DropdownMenuItem,{onClick:()=>V(!0),disabled:S,children:[jsxRuntime.jsx(Printer,{className:"mr-2 h-4 w-4"}),jsxRuntime.jsx("span",{children:"Print"})]}),jsxRuntime.jsx(DropdownMenuSeparator,{}),jsxRuntime.jsxs(DropdownMenuItem,{onClick:()=>V(!1),disabled:C,children:[jsxRuntime.jsx(Download,{className:"mr-2 h-4 w-4"}),jsxRuntime.jsx("span",{children:"Download"})]}),jsxRuntime.jsx(DropdownMenuSeparator,{}),jsxRuntime.jsxs(DropdownMenuItem,{onSelect:()=>j(!0),children:[jsxRuntime.jsx(Mail,{className:"mr-2 h-4 w-4"}),jsxRuntime.jsx("span",{children:"Send by Email"})]})]})]}),jsxRuntime.jsx(reactRouterDom.Link,{to:`${window.location.hostname==="dashboard.randmar.io"?"":"https://dashboard.randmar.io"}/${t}/PayInvoice`,target:window.location.hostname==="dashboard.randmar.io"?"_self":"_blank",children:jsxRuntime.jsxs(Button,{children:[jsxRuntime.jsx(CreditCard,{className:"mr-2 h-4 w-4"}),"Pay Invoices"]})})]})]})]}),jsxRuntime.jsx(Dialog,{open:I,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Send Statement by Email"}),jsxRuntime.jsx(DialogDescription,{children:"Enter the recipient's email address below. The statement will be sent as a PDF attachment."})]}),jsxRuntime.jsx("div",{className:"grid gap-4 py-4",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",className:"text-right",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",type:"email",value:q,onChange:ge=>z(ge.target.value),className:"col-span-3",placeholder:"recipient@example.com"})]})}),jsxRuntime.jsx(DialogFooter,{children:jsxRuntime.jsx(Button,{type:"submit",onClick:ne,disabled:A||!q,children:A?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Send,{className:"mr-2 h-4 w-4"}),"Send"]})})})]})})]})}function BillingItem({icon:t,label:e,value:n}){return jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap gap-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(t,{className:"size-4 text-muted-foreground"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:e})]}),jsxRuntime.jsx("span",{className:"text-base font-semibold ms-auto",children:n})]})}function ChangePricingTierModal({open:t,setOpen:e,tier:n,onTierChange:o,isLoading:l}){const d=()=>{e(!1)};return jsxRuntime.jsx(Dialog,{open:t,onOpenChange:e,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsx(DialogTitle,{children:"Change Pricing Tier"})}),jsxRuntime.jsxs("div",{className:"grid gap-1.5 py-2",children:[jsxRuntime.jsxs("p",{className:"text-lg text-muted-foreground",children:["Requested Pricing Tier: ",jsxRuntime.jsx("span",{className:"font-bold",children:n})]}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"If your account qualifies, your pricing will update immediately."}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"If not, we'll review your request and notify you of the decision."})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:d,disabled:l,children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:o,disabled:l,children:l?"Loading...":`Apply for ${n}`})]})]})})}const getPricingText=t=>t===1?"The Best":t===2?"Fixed 12.5% GP on all items":t===3?"Advantageous":t===4?"Buying Group":t===5?"Cost":t,getShippingText=t=>t==="A"?"Free or Custom":t==="B"?"Fixed $10 anywhere":t==="C"?`Free shipping on $150+ orders to your location,
1078
1078
  $15 for drop shipped orders under $1,500,
1079
- $10 with opportunities under $1,000`:t==="D"?"$15 under $1,500":t==="E"?"Full shipping charges":t,getTermsText=t=>t==="STRIPE"?"Credit card payment":t==="NET30"?"Net 30 days":t,AccountTier=({isSuperAdmin:t,readonly:e,reseller:n,appID:o,isLoading:l})=>{const{toast:d}=useToast(),[f,g]=React.useState(!1),[b,_]=React.useState(""),[S,{isLoading:R}]=usePostV4PartnerByApplicationIdAccountResellerAndFieldNameMutation(),C=Oe=>Oe&&{Starter:"starter","E-Commerce":"ecommerce",Commercial:"commercial",Basics:"cws",Novexco:"novexco","Jean Coutu":"jeancoutu",Exclusive:"exclusive"}[Oe]||"",E=Oe=>Oe&&{A:"free",B:"fixed",C:"dropshipped",D:"under1500",E:"fullcharges"}[Oe]||"",A=Oe=>Oe&&{1:"exclusive",2:"ecommerce",3:"commercial",4:"buyinggroup",5:"cost"}[Oe]||"",[M,I]=React.useState(C((n==null?void 0:n.Priority)??"")),[j,q]=React.useState(E((n==null?void 0:n.ShippingProfile)??"")),[z,Q]=React.useState(A(n==null?void 0:n.PriceProfile)),F=Oe=>({starter:"Starter",ecommerce:"E-Commerce",commercial:"Commercial",cws:"Basics",novexco:"Novexco",jeancoutu:"Jean Coutu",exclusive:"Exclusive"})[Oe]||Oe,V=Oe=>({free:"A",fixed:"B",dropshipped:"C",under1500:"D",fullcharges:"E"})[Oe]||Oe,te=Oe=>({exclusive:"1",ecommerce:"2",commercial:"3",buyinggroup:"4",cost:"5"})[Oe]||Oe;React.useEffect(()=>{I(C((n==null?void 0:n.Priority)??"")),q(E((n==null?void 0:n.ShippingProfile)??"")),Q(A(n==null?void 0:n.PriceProfile))},[n]);const ne=async(Oe,Fe,ze,$e)=>{try{(await S({applicationId:o,fieldName:Oe,newValue:Fe})).error?d({title:"Error",description:$e,variant:"destructive"}):d({title:"Success",description:ze,variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}},se=async Oe=>{I(Oe);const Fe=F(Oe);ne("Priority",Fe,`Priority updated to ${Fe}`,"Failed to update priority")},ge=async Oe=>{q(Oe);const Fe=V(Oe);ne("ShippingProfile",Fe,`Shipping profile updated to ${Fe}`,"Failed to update shipping profile")},oe=async Oe=>{Q(Oe);const Fe=te(Oe);ne("PriceProfile",Fe,`Pricing profile updated to ${Fe}`,"Failed to update pricing profile")},Ae=async()=>{try{const Oe=await S({applicationId:o,fieldName:"Tier",newValue:b});Oe.error?d({title:"Error",description:"Failed to update reseller",variant:"destructive"}):Oe.data?d({title:"Success",description:`Pricing Tier changed to ${b}`,variant:"success"}):d({title:"Considered",description:"Request being considered",variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}finally{g(!1),_("")}},je=[{name:"Terms",enabled:n.Priority==="Starter"},{name:"E-Commerce",enabled:n.Priority==="Commercial"},{name:"Commercial",enabled:n.Priority==="E-Commerce"},{name:"Exclusive",enabled:t}],Ne=Oe=>{_(Oe),g(!0)};return l?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{className:"pb-2",children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-28"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-16 rounded-full"})]})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"mb-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-56"})]}),jsxRuntime.jsx("div",{className:"grid gap-3",children:[1,2,3].map(Oe=>jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full shrink-0"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full"})]})]},Oe))}),jsxRuntime.jsxs("div",{className:"flex gap-2 mt-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{className:"pb-2 pt-4 px-4 flex flex-row items-center justify-between",children:[jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Account Tier"}),jsxRuntime.jsx(Badge,{variant:"secondary",className:"bg-green-100 text-green-700 hover:bg-green-200 text-xs",children:"Active"})]}),jsxRuntime.jsxs(CardContent,{className:"pt-2 px-4 pb-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 bg-primary/5 p-4 rounded-lg",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-bold text-primary",children:[(n==null?void 0:n.Priority)||""," Tier"]}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Optimized for online retail"})]}),jsxRuntime.jsx(CircleCheck,{className:"h-6 w-6 text-green-600"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-2 mb-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Package2,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Pricing"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground truncate",children:getPricingText(n.PriceProfile||0)})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Truck,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Shipping"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:getShippingText(n.ShippingProfile||"").split(".")[0]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Calendar,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Payment terms"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:getTermsText((n==null?void 0:n.Terms)||"")})]})]})]}),jsxRuntime.jsxs("div",{className:"flex gap-2",children:[!e&&jsxRuntime.jsx(Button,{variant:"outline",className:"flex-1",asChild:!0,children:jsxRuntime.jsxs("a",{href:"https://www.randmar.io/docs/overview/pricingTiers",target:"_blank",rel:"noreferrer",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4 mr-1"}),"Pricing Tiers"]})}),jsxRuntime.jsxs(Popover,{children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{disabled:e,className:e?"hidden":"flex-1",children:["Upgrade Tier ",jsxRuntime.jsx(ChevronRight,{className:"h-3 w-3 ml-1"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-56 p-2",children:jsxRuntime.jsxs("div",{className:"grid gap-1",children:[jsxRuntime.jsx("h4",{className:"font-medium text-xs mb-1",children:"Select a tier"}),je.map(Oe=>jsxRuntime.jsx(Button,{variant:"ghost",size:"sm",className:"w-full justify-start h-8",disabled:!Oe.enabled,onClick:()=>Ne(Oe.name),children:Oe.name},Oe.name))]})})]})]})]})]}),jsxRuntime.jsx(ChangePricingTierModal,{isLoading:R,open:f,setOpen:g,tier:b,onTierChange:Ae}),t&&!e&&jsxRuntime.jsxs(Card,{className:"mt-4",children:[jsxRuntime.jsx(CardHeader,{className:"pb-2 pt-3 px-4",children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Admin Configuration"})}),jsxRuntime.jsx(CardContent,{className:"pt-2 px-4 pb-4",children:jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Priority"}),jsxRuntime.jsx(RadioGroup$1,{value:M,onValueChange:se,className:"grid grid-cols-2 @sm:grid-cols-3 @md:grid-cols-4 gap-1",children:[{value:"starter",label:"Starter"},{value:"ecommerce",label:"E-Commerce"},{value:"commercial",label:"Commercial"},{value:"cws",label:"CWS (Basics)"},{value:"novexco",label:"Novexco"},{value:"jeancoutu",label:"Jean Coutu"},{value:"exclusive",label:"Exclusive"}].map(Oe=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:Oe.value,id:`priority-${Oe.value}`,className:"h-6 w-6 scale-50"}),jsxRuntime.jsx(Label$2,{htmlFor:`priority-${Oe.value}`,className:"cursor-pointer text-xs",children:Oe.label})]},Oe.value))})]}),jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Shipping Profile"}),jsxRuntime.jsx(RadioGroup$1,{value:j,onValueChange:ge,className:"grid grid-cols-1 @md:grid-cols-2 gap-1",children:[{value:"free",label:"Free (A)"},{value:"fixed",label:"Fixed $10 Shipping (B)"},{value:"dropshipped",label:"$15 for drop shipped (C)"},{value:"under1500",label:"15$ under 1,500 (D)"},{value:"fullcharges",label:"Full shipping charges (E)"}].map(Oe=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:Oe.value,id:`shipping-${Oe.value}`,className:"h-6 w-6 scale-50"}),jsxRuntime.jsx(Label$2,{htmlFor:`shipping-${Oe.value}`,className:"cursor-pointer text-xs",children:Oe.label})]},Oe.value))})]}),jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Pricing Profile"}),jsxRuntime.jsx(RadioGroup$1,{value:z,onValueChange:oe,className:"grid grid-cols-2 @sm:grid-cols-3 gap-1",children:[{value:"exclusive",label:"Exclusive (1)"},{value:"ecommerce",label:"E-Commerce (2)"},{value:"commercial",label:"Commercial (3)"},{value:"buyinggroup",label:"Buying Group (4)"},{value:"cost",label:"Cost (5)"}].map(Oe=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:Oe.value,id:`pricing-${Oe.value}`,className:"h-6 w-6 scale-50 antialiased"}),jsxRuntime.jsx(Label$2,{htmlFor:`pricing-${Oe.value}`,className:"cursor-pointer text-xs",children:Oe.label})]},Oe.value))})]})]})})]})]})};function OrderCategories({openOrders:t=[],isLoading:e=!1}){const n=(t==null?void 0:t.filter(M=>M.DocumentType==="Order"))||[],o=(t==null?void 0:t.filter(M=>M.DocumentType==="Shipment"))||[],l=n.filter(M=>M.WarehouseCode!=="3PLE"),d=l.reduce((M,I)=>M+(I.Quantity??0),0),f=l.reduce((M,I)=>M+(I.ExtendedPrice??0),0),g=n.filter(M=>M.WarehouseCode==="3PLE"),b=g.reduce((M,I)=>M+(I.Quantity??0),0),_=g.reduce((M,I)=>M+(I.ExtendedPrice??0),0),S=o.reduce((M,I)=>M+(I.Quantity??0),0),R=o.reduce((M,I)=>M+(I.ExtendedPrice??0),0),C=d+b+S,E=f+_+R,A=[{name:"All",icon:Package,color:"bg-blue-500",orders:C,amount:E},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",orders:d,amount:f},{name:"Shipped",icon:Truck,color:"bg-green-500",orders:S,amount:R},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",orders:b,amount:_}];return e?jsxRuntime.jsxs(Card,{className:"w-full @md:col-span-2 @xl:col-span-1",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-40"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:[1,2,3,4].map(M=>jsxRuntime.jsx(Card,{className:"overflow-hidden rounded-md rounded-b-lg border-0 shadow-md",children:jsxRuntime.jsxs(CardContent,{className:"p-0",children:[jsxRuntime.jsx("div",{className:"bg-gray-200 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]})},M))})})]}):jsxRuntime.jsxs(Card,{className:"w-full @md:col-span-2 @xl:col-span-1",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Order Categories"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:A.map(M=>jsxRuntime.jsx(Card,{className:"overflow-hidden rounded-md rounded-b-lg border-0 shadow-md",children:jsxRuntime.jsxs(CardContent,{className:"p-0",children:[jsxRuntime.jsx("div",{className:`${M.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:M.name}),jsxRuntime.jsx("div",{className:`${M.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(M.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:M.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:jsxRuntime.jsx(FormattedNumber,{value:M.amount,style:"currency",currency:"CAD",currencyDisplay:"symbol"})})]})]})]})]})},M.name))})})]})}function ReportsSection({isLoading:t,userEmail:e,appID:n}){const{toast:o}=useToast(),[l,{isLoading:d}]=usePostV4ResellerByRouteResellerIdReportWalmartTrackingFileEmailMutation(),[f,{isLoading:g}]=usePostV4ResellerByRouteResellerIdReportAmazonTrackingFileEmailMutation(),[b,{isLoading:_}]=usePostV4ResellerByRouteResellerIdReportOpenOrdersEmailMutation(),[S,{isLoading:R}]=usePostV4ResellerByRouteResellerIdReportProductsEmailMutation(),[C,{isLoading:E}]=usePostV4ResellerByRouteResellerIdReportInvoicesEmailMutation(),[A,{isLoading:M}]=usePostV4ResellerByRouteResellerIdDocumentStatementEmailMutation(),[I,j]=React.useState(null),[q,z]=React.useState(e),[Q,F]=React.useState(!1),V=[{name:"Products",reports:[{id:"Products",title:"Universal Product List",description:"A comprehensive overview of your product list with detailed specifications and pricing information.",icon:Package}]},{name:"Operation Details",reports:[{id:"OpenOrders",title:"Order Details",description:"A detailed report of all your orders and shipments, including status, tracking information, and delivery estimates.",icon:ShoppingCart},{id:"Invoices",title:"Invoices and Credits Report",description:"Detailed overview of your invoices and credits within a specific date range. It also contains reports about additional charges, serial numbers, and other relevant information.",icon:ScrollText},{id:"Statement",title:"Statement and RMAs Report",description:"A detailed report of all unpaid invoices and active RMAs.",icon:Banknote}]},{name:"Tracking Files",reports:[{id:"AmazonTrackingFile",title:"Amazon Tracking File",description:"Track products sold on Amazon marketplace with detailed sales and inventory information.",icon:ChartNoAxesColumnIncreasing},{id:"WalmartTrackingFile",title:"Walmart Tracking File",description:"Track products sold on Walmart marketplace with detailed sales and inventory information.",icon:ChartNoAxesColumnIncreasing}]}],te=async ge=>{j(ge),F(!0)},ne=async()=>{if(!(!I||!n))try{switch(I.id){case"Products":await S({routeResellerId:n,emailAddress:q}).unwrap();break;case"AmazonTrackingFile":await f({routeResellerId:n,emailAddress:q}).unwrap();break;case"WalmartTrackingFile":await l({routeResellerId:n,emailAddress:q}).unwrap();break;case"OpenOrders":await b({routeResellerId:n,emailAddress:q}).unwrap();break;case"Invoices":await C({routeResellerId:n,emailAddress:q}).unwrap();break;case"Statement":await A({routeResellerId:n,emailAddress:q}).unwrap();break;default:throw new Error("invalid report id")}o({title:"Report requested",description:`The ${I.title} will be sent to ${q} shortly.`,variant:"success"}),F(!1)}catch(ge){console.error("Error requesting report:",ge),o({title:"Error",description:"Failed to request report. Please try again.",variant:"destructive"})}},se=_||R||g||d||M||E;return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reports"}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Download essential business reports, from your Product List to your Order Details."})]}),jsxRuntime.jsx(CardContent,{className:"space-y-6",children:t?jsxRuntime.jsx(jsxRuntime.Fragment,{children:[1,2,3].map(ge=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-48"}),[1,2].map(oe=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"})]},oe))]},ge))}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:V.map(ge=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold",children:ge.name}),ge.reports.map(oe=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg hover:bg-gray-100 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:jsxRuntime.jsx(oe.icon,{className:"h-5 w-5 text-primary"})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h4",{className:"font-semibold text-sm",children:oe.title}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:oe.description})]}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",className:"flex items-center gap-1",onClick:()=>te(oe),children:[jsxRuntime.jsx(Download,{className:"h-4 w-4"}),"Request"]})]},oe.id))]},ge.name))})}),jsxRuntime.jsx(Dialog,{open:Q,onOpenChange:F,children:jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsxs(DialogTitle,{children:["Request ",I==null?void 0:I.title]}),jsxRuntime.jsx(DialogDescription,{children:"Enter the email address where you would like to receive the report."})]}),jsxRuntime.jsxs("div",{className:"py-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",value:q,onChange:ge=>z(ge.target.value),placeholder:"your@email.com",className:"mt-2"})]}),jsxRuntime.jsx(DialogDescription,{children:"The report will take around 5 minutes to generate."}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:ne,disabled:!q||se,children:se?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):"Send Report"})]})]})})]})}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:o,children:l,...d},f)=>jsxRuntime.jsxs("div",{ref:f,className:cn(badgeVariants({variant:e,size:n}),t),...d,children:[o&&jsxRuntime.jsx("span",{className:"mr-1",children:o}),l]}));Badge.displayName="Badge";function QualificationBadge({qualification:t}){return!t.QualificationId||t.QualificationId==="Suspended"?null:t.QualificationId==="Do Not Sell"?jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"destructive",children:[jsxRuntime.jsx(X$1,{className:"h-3 w-3 mr-1"}),"Do Not Sell"]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})}):jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"info",className:t.DefaultOpportunityNumber?"pr-1":"",children:[jsxRuntime.jsx(BadgeCheck,{className:"h-3 w-3 mr-1"}),t.QualificationId,t.DefaultOpportunityNumber&&jsxRuntime.jsx(Badge,{variant:"secondary",size:"sm",className:"ml-1",children:t.DefaultOpportunityNumber})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})})}function SalesChart({statistics:t,mode:e="month",chartHeight:n,loading:o=!1,size:l="default"}){const[d,f]=React.useState([]),[g,b]=React.useState(!1),_=[{name:"dollarVolume",label:"Dollar Volume",color:"var(--primary)",yAxisId:"left",format:"money"},{name:"unitsSold",label:"Units Sold",color:"#888",units:" units",yAxisId:"right"}];return React.useEffect(()=>{if(o||!t){f([]);return}let S=[];if(e==="week"){const R=new Map;t.forEach(C=>{var A;const E=((A=C.Day)==null?void 0:A.toString())||"";if(E.length===8){const M=parseInt(E.substring(0,4),10),I=parseInt(E.substring(4,6),10)-1,j=parseInt(E.substring(6,8),10),q=new Date(M,I,j),z=new Date(q);z.setDate(q.getDate()-q.getDay());const Q=`${z.getFullYear()}-${String(z.getMonth()+1).padStart(2,"0")}-${String(z.getDate()).padStart(2,"0")}`,F=R.get(Q)||{price:0,quantity:0};F.price+=C.ExtendedPrice||0,F.quantity+=C.Quantity||0,R.set(Q,F)}}),S=Array.from(R).sort(([C],[E])=>C.localeCompare(E)).map(([C,E])=>({date:`${C.substring(5,7)}/${C.substring(8,10)}`,dollarVolume:E.price,unitsSold:E.quantity}))}else{const R=new Date,C=R.getFullYear(),E=R.getMonth(),A=R.getDate(),M=`${C}-${(E+1).toString().padStart(2,"0")}`,I=Array.from({length:12},(q,z)=>{const Q=new Date(C,E-(11-z),1);return`${Q.getFullYear()}-${(Q.getMonth()+1).toString().padStart(2,"0")}`}),j=Object.fromEntries(I.map(q=>[q,{price:0,quantity:0}]));if(t.forEach(q=>{const z=String(q.Day??0);if(z.length!==8)return;const Q=`${z.substring(0,4)}-${z.substring(4,6)}`;j.hasOwnProperty(Q)&&(j[Q].price+=q.ExtendedPrice??0,j[Q].quantity+=q.Quantity??0)}),S=I.map(q=>{const z=j[q],[Q,F]=q.split("-").map(Number);return{date:new Date(Q,F-1).toLocaleString("default",{month:"short",year:"numeric"}),dollarVolume:z.price,unitsSold:z.quantity}}),g){const q=j[M];if(q&&q.price>0&&A>0){const z=new Date(C,E+1,0).getDate();if(A<z){const Q=q.price/A,F=q.quantity/A,V=Q*z,te=F*z,ne=S[S.length-1];ne&&(ne.dollarVolume=V,ne.unitsSold=te)}}}}f(S)},[t,e,g,o]),o?jsxRuntime.jsx("div",{style:{height:n},children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full rounded-md"})}):d.length===0?jsxRuntime.jsx("div",{style:{height:n},className:"flex items-center justify-center text-muted-foreground",children:"No sales data available."}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(AreaChart,{data:d,series:_,height:n,size:l}),l==="default"&&e==="month"&&jsxRuntime.jsxs("div",{className:"mt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Switch,{checked:g,onCheckedChange:b,id:"extrapolate-switch"}),jsxRuntime.jsx(Label$2,{htmlFor:"extrapolate-switch",children:"Extrapolate Current Month"})]}),g&&jsxRuntime.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["* Values for ",new Date().toLocaleString("default",{month:"long"})," are projected estimates."]})]})]})}function ManufacturerCard({manufacturer:t,link:e,linkNewTab:n=!0,actions:o,mainAction:l,loading:d=!1}){var S,R,C;if(d||!t)return jsxRuntime.jsxs(Card,{className:"flex flex-col h-full",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]}),jsxRuntime.jsx(Skeleton,{className:"h-16 w-24"})]}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex flex-col space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const f=t.ManufacturerId||"N/A",g=[t.City,t.Province,t.Country].filter(Boolean),b=g.length>0?g.join(", "):"",_=((S=t.Tags)==null?void 0:S.split(",").map(E=>E.trim()).filter(Boolean))||[];return jsxRuntime.jsxs(Card,{className:"manufacturer-theme flex flex-col h-full",children:[jsxRuntime.jsx(reactRouterDom.Link,{to:e??"#",target:e&&n?"_blank":"_self",children:jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx(PartnerLogo,{id:t.ManufacturerId,width:48,height:48})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Manufacturer"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:f})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"}),t.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t.Name}),b&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:b})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:t.SalesStatistics&&t.SalesStatistics.length>0&&jsxRuntime.jsx("div",{className:"h-16 w-24",children:jsxRuntime.jsx(SalesChart,{statistics:t.SalesStatistics,size:"mini"})})})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[(!!((R=t.Qualification)!=null&&R.QualificationId)&&((C=t.Qualification)==null?void 0:C.QualificationId)!=="Suspended"||!!t.OpenToWork||!!t.OnHold&&t.OnHold!==0||_.length>0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(QualificationBadge,{qualification:t.Qualification??{}}),!!t.OpenToWork&&jsxRuntime.jsxs(Badge,{variant:"success",children:[jsxRuntime.jsx(HardHat,{className:"h-3 w-3 mr-1"}),"Open To Work"]}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"}),_.map((E,A)=>jsxRuntime.jsx(Badge,{variant:"outline",children:E},A))]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${t.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${t.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:t.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})]}),t.SalesData&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:t.SalesData.SalesYearToDay?formatMoney(t.SalesData.SalesYearToDay):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:t.SalesData.SalesLast3Months?formatMoney(t.SalesData.SalesLast3Months):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:t.SalesData.SalesLast30Days?formatMoney(t.SalesData.SalesLast30Days):"—"})]})]})}),(o||l||t.PublicResourcesLink)&&jsxRuntime.jsxs(CardFooter,{className:"flex pt-2 gap-2 justify-between mt-auto",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[o&&o,t.PublicResourcesLink&&jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:t.PublicResourcesLink,target:"_blank",children:jsxRuntime.jsx(Button,{size:"icon",children:jsxRuntime.jsx(HardDriveDownload,{className:"h-4 w-4"})})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Public Resources Link"})})]})})]}),l&&jsxRuntime.jsx("div",{children:l})]})]})}function OrdersCard({applicationId:t,orders:e=null,loading:n=!1,title:o="Order Details"}){const l=React.useMemo(()=>[{accessorKey:"DocumentNumber",header:"Document Number",cell:({row:g})=>g.original.DocumentNumber?jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:`/${t}/Document/${g.original.DocumentNumber}`,className:"font-medium text-primary hover:underline",children:g.original.DocumentNumber})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["View details for order ",g.original.DocumentNumber]})})]})}):"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"DocumentDate",header:"Document Date",cell:({row:g})=>formatYYYYMMDDIntToDateString(g.original.DocumentDate),enableSorting:!0,enableFiltering:!1},{accessorKey:"OrderNumber",header:"Order Number",cell:({row:g})=>g.original.OrderNumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"PONumber",header:"PO Number",cell:({row:g})=>g.original.PONumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"WarehouseCode",header:"Warehouse",cell:({row:g})=>g.original.WarehouseCode??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:g})=>g.original.Quantity??"N/A",enableSorting:!0,enableFiltering:!1},{accessorKey:"ShipToName",header:"Name",cell:({row:g})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:g.original.ShipToName??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"UnitPrice",header:"Unit Price",cell:({row:g})=>g.original.UnitPrice?formatMoney(g.original.UnitPrice):"N/A",enableSorting:!0,enableFiltering:!1}],[]),d=React.useMemo(()=>{const g={};if(e){const b=Array.from(new Set(e.map(E=>E.WarehouseCode).filter(E=>E!=null)));g.WarehouseCode=b;const _=Array.from(new Set(e.map(E=>E.ShipToName).filter(E=>E!=null)));g.ShipToName=_;const S=Array.from(new Set(e.map(E=>E.DocumentNumber).filter(E=>E!=null)));g.DocumentNumber=S;const R=Array.from(new Set(e.map(E=>E.OrderNumber).filter(E=>E!=null)));g.OrderNumber=R;const C=Array.from(new Set(e.map(E=>E.PONumber).filter(E=>E!=null)));g.PONumber=C}return g},[e]),f=e||[];return n?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-48"})," "]}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:o})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:l,data:f,uniqueValues:d})})]})}function ResellerOverview({appID:t,reseller:e,readonly:n,userEmail:o,isSuperAdmin:l,withoutReports:d=!1}){const{data:f,isLoading:g,isError:b}=useGetV4PartnerByApplicationIdAccountResellerQuery({applicationId:t??"",withSpecification:!0},{skip:!!e}),[_,S]=React.useState({publicInfo:{hasUnsavedChanges:!1}}),R=React.useCallback(()=>n?!1:_.publicInfo.hasUnsavedChanges,[n,_]),C=React.useCallback((q,z)=>{S(Q=>{var F;return((F=Q[q])==null?void 0:F.hasUnsavedChanges)!==z.hasUnsavedChanges?{...Q,[q]:z}:Q})},[]),{NavigationGuardDialog:E}=useRouterNavigationGuard(R),A=e??f,M=!n||!!(A!=null&&A.Statement)&&(A.Statement.Total??0)>0,I=(A==null?void 0:A.QualifiedManufacturers)??[],j=(A==null?void 0:A.Qualifications)??[];return jsxRuntime.jsxs("div",{className:"@container",children:[b?jsxRuntime.jsx(Card,{className:"p-6",children:jsxRuntime.jsxs(Alert,{variant:"destructive",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Error"}),jsxRuntime.jsx(AlertDescription,{children:"There was an error loading your reseller information. Please try again later."})]})}):jsxRuntime.jsxs("div",{className:"space-y-6 mb-6",children:[jsxRuntime.jsx(SalesSummary,{fiscalYearMonthStart:(A==null?void 0:A.FiscalYearMonthStart)||1,salesData:A==null?void 0:A.SalesData,isLoading:g}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @2xl:grid-cols-2 gap-6",children:[jsxRuntime.jsx(SalesChartCard,{statistics:(A==null?void 0:A.SalesStatistics)??[],loading:g}),jsxRuntime.jsx(OrderCategories,{openOrders:(A==null?void 0:A.ActiveOrderDetails)??[],isLoading:g}),M&&jsxRuntime.jsx(BillingCard,{appID:t,reseller:A||{},withoutReports:d,isLoading:g,userEmail:o}),jsxRuntime.jsx(PublicInfo,{reseller:A||{},appID:t??"",isLoading:g,readonly:n,onUnsavedChanges:q=>C("publicInfo",{hasUnsavedChanges:q})}),jsxRuntime.jsx(AccountTier,{isSuperAdmin:l,readonly:n,reseller:A||{},appID:t??"",isLoading:g})]}),g||I.length>0?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Manufacturers you are qualified for"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid @2xl:grid-cols-2 gap-4",children:g?Array.from({length:2}).map((q,z)=>jsxRuntime.jsx(ManufacturerCard,{loading:!0},z)):I.map(q=>jsxRuntime.jsx(ManufacturerCard,{manufacturer:q,link:`https://dashboard.randmar.io/${t}/Partner/${q.ManufacturerId}`},q.ManufacturerId))})})]}):jsxRuntime.jsx(ResellerQualificationsCard,{qualifications:j}),jsxRuntime.jsx(OpportunitiesTable,{applicationId:t,opportunities:A==null?void 0:A.Opportunities,loading:g}),jsxRuntime.jsx(OrdersCard,{applicationId:t,title:"Active Orders",orders:A==null?void 0:A.ActiveOrderDetails,loading:g}),jsxRuntime.jsx(OrdersCard,{applicationId:t,title:"Completed Orders",orders:A==null?void 0:A.CompletedOrderDetails,loading:g}),jsxRuntime.jsx(ReturnsTable,{applicationId:t,returns:A==null?void 0:A.Returns,loading:g}),!d&&jsxRuntime.jsx(ReportsSection,{appID:t,userEmail:o,isLoading:g})]}),jsxRuntime.jsx(E,{})]})}const alertVariants=cva("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",success:"border-green-500/50 bg-green-50 text-green-700 dark:border-green-500 dark:bg-green-950 dark:text-green-400 [&>svg]:text-green-500",warning:"border-yellow-500/50 bg-yellow-50 text-yellow-700 dark:border-yellow-500 dark:bg-yellow-950 dark:text-yellow-400 [&>svg]:text-yellow-500",info:"border-blue-500/50 bg-blue-50 text-blue-700 dark:border-blue-500 dark:bg-blue-950 dark:text-blue-400 [&>svg]:text-blue-500"}},defaultVariants:{variant:"default"}}),Alert=React__namespace.forwardRef(({className:t,variant:e,...n},o)=>jsxRuntime.jsx("div",{ref:o,role:"alert",className:cn(alertVariants({variant:e}),t),...n}));Alert.displayName="Alert";const AlertTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("h5",{ref:n,className:cn("mb-1 font-medium leading-none tracking-tight",t),...e}));AlertTitle.displayName="AlertTitle";const AlertDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("text-sm [&_p]:leading-relaxed",t),...e}));AlertDescription.displayName="AlertDescription";/**
1079
+ $10 with opportunities under $1,000`:t==="D"?"$15 under $1,500":t==="E"?"Full shipping charges":t,getTermsText=t=>t==="STRIPE"?"Credit card payment":t==="NET30"?"Net 30 days":t,AccountTier=({isSuperAdmin:t,readonly:e,reseller:n,appID:o,isLoading:l})=>{const{toast:d}=useToast(),[f,g]=React.useState(!1),[b,_]=React.useState(""),[S,{isLoading:R}]=usePostV4PartnerByApplicationIdAccountResellerAndFieldNameMutation(),C=Oe=>Oe&&{Starter:"starter","E-Commerce":"ecommerce",Commercial:"commercial",Basics:"cws",Novexco:"novexco","Jean Coutu":"jeancoutu",Exclusive:"exclusive"}[Oe]||"",E=Oe=>Oe&&{A:"free",B:"fixed",C:"dropshipped",D:"under1500",E:"fullcharges"}[Oe]||"",A=Oe=>Oe&&{1:"exclusive",2:"ecommerce",3:"commercial",4:"buyinggroup",5:"cost"}[Oe]||"",[M,I]=React.useState(C((n==null?void 0:n.Priority)??"")),[j,q]=React.useState(E((n==null?void 0:n.ShippingProfile)??"")),[z,Q]=React.useState(A(n==null?void 0:n.PriceProfile)),F=Oe=>({starter:"Starter",ecommerce:"E-Commerce",commercial:"Commercial",cws:"Basics",novexco:"Novexco",jeancoutu:"Jean Coutu",exclusive:"Exclusive"})[Oe]||Oe,V=Oe=>({free:"A",fixed:"B",dropshipped:"C",under1500:"D",fullcharges:"E"})[Oe]||Oe,te=Oe=>({exclusive:"1",ecommerce:"2",commercial:"3",buyinggroup:"4",cost:"5"})[Oe]||Oe;React.useEffect(()=>{I(C((n==null?void 0:n.Priority)??"")),q(E((n==null?void 0:n.ShippingProfile)??"")),Q(A(n==null?void 0:n.PriceProfile))},[n]);const ne=async(Oe,Fe,ze,$e)=>{try{(await S({applicationId:o,fieldName:Oe,newValue:Fe})).error?d({title:"Error",description:$e,variant:"destructive"}):d({title:"Success",description:ze,variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}},se=async Oe=>{I(Oe);const Fe=F(Oe);ne("Priority",Fe,`Priority updated to ${Fe}`,"Failed to update priority")},ge=async Oe=>{q(Oe);const Fe=V(Oe);ne("ShippingProfile",Fe,`Shipping profile updated to ${Fe}`,"Failed to update shipping profile")},oe=async Oe=>{Q(Oe);const Fe=te(Oe);ne("PriceProfile",Fe,`Pricing profile updated to ${Fe}`,"Failed to update pricing profile")},Ae=async()=>{try{const Oe=await S({applicationId:o,fieldName:"Tier",newValue:b});Oe.error?d({title:"Error",description:"Failed to update reseller",variant:"destructive"}):Oe.data?d({title:"Success",description:`Pricing Tier changed to ${b}`,variant:"success"}):d({title:"Considered",description:"Request being considered",variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}finally{g(!1),_("")}},je=[{name:"Terms",enabled:n.Priority==="Starter"},{name:"E-Commerce",enabled:n.Priority==="Commercial"},{name:"Commercial",enabled:n.Priority==="E-Commerce"},{name:"Exclusive",enabled:t}],Ne=Oe=>{_(Oe),g(!0)};return l?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{className:"pb-2",children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-28"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-16 rounded-full"})]})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"mb-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-56"})]}),jsxRuntime.jsx("div",{className:"grid gap-3",children:[1,2,3].map(Oe=>jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full shrink-0"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full"})]})]},Oe))}),jsxRuntime.jsxs("div",{className:"flex gap-2 mt-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{className:"pb-2 pt-4 px-4 flex flex-row items-center justify-between",children:[jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Account Tier"}),jsxRuntime.jsx(Badge,{variant:"secondary",className:"bg-green-100 text-green-700 hover:bg-green-200 text-xs",children:"Active"})]}),jsxRuntime.jsxs(CardContent,{className:"pt-2 px-4 pb-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 bg-primary/5 p-4 rounded-lg",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-bold text-primary",children:[(n==null?void 0:n.Priority)||""," Tier"]}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Optimized for online retail"})]}),jsxRuntime.jsx(CircleCheck,{className:"h-6 w-6 text-green-600"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-2 mb-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Package2,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Pricing"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground truncate",children:getPricingText(n.PriceProfile||0)})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Truck,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Shipping"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:getShippingText(n.ShippingProfile||"").split(".")[0]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Calendar,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Payment terms"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:getTermsText((n==null?void 0:n.Terms)||"")})]})]})]}),jsxRuntime.jsxs("div",{className:"flex gap-2",children:[!e&&jsxRuntime.jsx(Button,{variant:"outline",className:"flex-1",asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:"https://www.randmar.io/docs/overview/pricingTiers",target:"_blank",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4 mr-1"}),"Pricing Tiers"]})}),jsxRuntime.jsxs(Popover,{children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{disabled:e,className:e?"hidden":"flex-1",children:["Upgrade Tier ",jsxRuntime.jsx(ChevronRight,{className:"h-3 w-3 ml-1"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-56 p-2",children:jsxRuntime.jsxs("div",{className:"grid gap-1",children:[jsxRuntime.jsx("h4",{className:"font-medium text-xs mb-1",children:"Select a tier"}),je.map(Oe=>jsxRuntime.jsx(Button,{variant:"ghost",size:"sm",className:"w-full justify-start h-8",disabled:!Oe.enabled,onClick:()=>Ne(Oe.name),children:Oe.name},Oe.name))]})})]})]})]})]}),jsxRuntime.jsx(ChangePricingTierModal,{isLoading:R,open:f,setOpen:g,tier:b,onTierChange:Ae}),t&&!e&&jsxRuntime.jsxs(Card,{className:"mt-4",children:[jsxRuntime.jsx(CardHeader,{className:"pb-2 pt-3 px-4",children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Admin Configuration"})}),jsxRuntime.jsx(CardContent,{className:"pt-2 px-4 pb-4",children:jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Priority"}),jsxRuntime.jsx(RadioGroup$1,{value:M,onValueChange:se,className:"grid grid-cols-2 @sm:grid-cols-3 @md:grid-cols-4 gap-1",children:[{value:"starter",label:"Starter"},{value:"ecommerce",label:"E-Commerce"},{value:"commercial",label:"Commercial"},{value:"cws",label:"CWS (Basics)"},{value:"novexco",label:"Novexco"},{value:"jeancoutu",label:"Jean Coutu"},{value:"exclusive",label:"Exclusive"}].map(Oe=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:Oe.value,id:`priority-${Oe.value}`,className:"h-6 w-6 scale-50"}),jsxRuntime.jsx(Label$2,{htmlFor:`priority-${Oe.value}`,className:"cursor-pointer text-xs",children:Oe.label})]},Oe.value))})]}),jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Shipping Profile"}),jsxRuntime.jsx(RadioGroup$1,{value:j,onValueChange:ge,className:"grid grid-cols-1 @md:grid-cols-2 gap-1",children:[{value:"free",label:"Free (A)"},{value:"fixed",label:"Fixed $10 Shipping (B)"},{value:"dropshipped",label:"$15 for drop shipped (C)"},{value:"under1500",label:"15$ under 1,500 (D)"},{value:"fullcharges",label:"Full shipping charges (E)"}].map(Oe=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:Oe.value,id:`shipping-${Oe.value}`,className:"h-6 w-6 scale-50"}),jsxRuntime.jsx(Label$2,{htmlFor:`shipping-${Oe.value}`,className:"cursor-pointer text-xs",children:Oe.label})]},Oe.value))})]}),jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Pricing Profile"}),jsxRuntime.jsx(RadioGroup$1,{value:z,onValueChange:oe,className:"grid grid-cols-2 @sm:grid-cols-3 gap-1",children:[{value:"exclusive",label:"Exclusive (1)"},{value:"ecommerce",label:"E-Commerce (2)"},{value:"commercial",label:"Commercial (3)"},{value:"buyinggroup",label:"Buying Group (4)"},{value:"cost",label:"Cost (5)"}].map(Oe=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:Oe.value,id:`pricing-${Oe.value}`,className:"h-6 w-6 scale-50 antialiased"}),jsxRuntime.jsx(Label$2,{htmlFor:`pricing-${Oe.value}`,className:"cursor-pointer text-xs",children:Oe.label})]},Oe.value))})]})]})})]})]})};function OrderCategories({openOrders:t=[],isLoading:e=!1}){const n=(t==null?void 0:t.filter(M=>M.DocumentType==="Order"))||[],o=(t==null?void 0:t.filter(M=>M.DocumentType==="Shipment"))||[],l=n.filter(M=>M.WarehouseCode!=="3PLE"),d=l.reduce((M,I)=>M+(I.Quantity??0),0),f=l.reduce((M,I)=>M+(I.ExtendedPrice??0),0),g=n.filter(M=>M.WarehouseCode==="3PLE"),b=g.reduce((M,I)=>M+(I.Quantity??0),0),_=g.reduce((M,I)=>M+(I.ExtendedPrice??0),0),S=o.reduce((M,I)=>M+(I.Quantity??0),0),R=o.reduce((M,I)=>M+(I.ExtendedPrice??0),0),C=d+b+S,E=f+_+R,A=[{name:"All",icon:Package,color:"bg-blue-500",orders:C,amount:E},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",orders:d,amount:f},{name:"Shipped",icon:Truck,color:"bg-green-500",orders:S,amount:R},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",orders:b,amount:_}];return e?jsxRuntime.jsxs(Card,{className:"w-full @md:col-span-2 @xl:col-span-1",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-40"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:[1,2,3,4].map(M=>jsxRuntime.jsx(Card,{className:"overflow-hidden rounded-md rounded-b-lg border-0 shadow-md",children:jsxRuntime.jsxs(CardContent,{className:"p-0",children:[jsxRuntime.jsx("div",{className:"bg-gray-200 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]})},M))})})]}):jsxRuntime.jsxs(Card,{className:"w-full @md:col-span-2 @xl:col-span-1",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Order Categories"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:A.map(M=>jsxRuntime.jsx(Card,{className:"overflow-hidden rounded-md rounded-b-lg border-0 shadow-md",children:jsxRuntime.jsxs(CardContent,{className:"p-0",children:[jsxRuntime.jsx("div",{className:`${M.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:M.name}),jsxRuntime.jsx("div",{className:`${M.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(M.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:M.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:jsxRuntime.jsx(FormattedNumber,{value:M.amount,style:"currency",currency:"CAD",currencyDisplay:"symbol"})})]})]})]})]})},M.name))})})]})}function ReportsSection({isLoading:t,userEmail:e,appID:n}){const{toast:o}=useToast(),[l,{isLoading:d}]=usePostV4ResellerByRouteResellerIdReportWalmartTrackingFileEmailMutation(),[f,{isLoading:g}]=usePostV4ResellerByRouteResellerIdReportAmazonTrackingFileEmailMutation(),[b,{isLoading:_}]=usePostV4ResellerByRouteResellerIdReportOpenOrdersEmailMutation(),[S,{isLoading:R}]=usePostV4ResellerByRouteResellerIdReportProductsEmailMutation(),[C,{isLoading:E}]=usePostV4ResellerByRouteResellerIdReportInvoicesEmailMutation(),[A,{isLoading:M}]=usePostV4ResellerByRouteResellerIdDocumentStatementEmailMutation(),[I,j]=React.useState(null),[q,z]=React.useState(e),[Q,F]=React.useState(!1),V=[{name:"Products",reports:[{id:"Products",title:"Universal Product List",description:"A comprehensive overview of your product list with detailed specifications and pricing information.",icon:Package}]},{name:"Operation Details",reports:[{id:"OpenOrders",title:"Order Details",description:"A detailed report of all your orders and shipments, including status, tracking information, and delivery estimates.",icon:ShoppingCart},{id:"Invoices",title:"Invoices and Credits Report",description:"Detailed overview of your invoices and credits within a specific date range. It also contains reports about additional charges, serial numbers, and other relevant information.",icon:ScrollText},{id:"Statement",title:"Statement and RMAs Report",description:"A detailed report of all unpaid invoices and active RMAs.",icon:Banknote}]},{name:"Tracking Files",reports:[{id:"AmazonTrackingFile",title:"Amazon Tracking File",description:"Track products sold on Amazon marketplace with detailed sales and inventory information.",icon:ChartNoAxesColumnIncreasing},{id:"WalmartTrackingFile",title:"Walmart Tracking File",description:"Track products sold on Walmart marketplace with detailed sales and inventory information.",icon:ChartNoAxesColumnIncreasing}]}],te=async ge=>{j(ge),F(!0)},ne=async()=>{if(!(!I||!n))try{switch(I.id){case"Products":await S({routeResellerId:n,emailAddress:q}).unwrap();break;case"AmazonTrackingFile":await f({routeResellerId:n,emailAddress:q}).unwrap();break;case"WalmartTrackingFile":await l({routeResellerId:n,emailAddress:q}).unwrap();break;case"OpenOrders":await b({routeResellerId:n,emailAddress:q}).unwrap();break;case"Invoices":await C({routeResellerId:n,emailAddress:q}).unwrap();break;case"Statement":await A({routeResellerId:n,emailAddress:q}).unwrap();break;default:throw new Error("invalid report id")}o({title:"Report requested",description:`The ${I.title} will be sent to ${q} shortly.`,variant:"success"}),F(!1)}catch(ge){console.error("Error requesting report:",ge),o({title:"Error",description:"Failed to request report. Please try again.",variant:"destructive"})}},se=_||R||g||d||M||E;return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reports"}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Download essential business reports, from your Product List to your Order Details."})]}),jsxRuntime.jsx(CardContent,{className:"space-y-6",children:t?jsxRuntime.jsx(jsxRuntime.Fragment,{children:[1,2,3].map(ge=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-48"}),[1,2].map(oe=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"})]},oe))]},ge))}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:V.map(ge=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold",children:ge.name}),ge.reports.map(oe=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg hover:bg-gray-100 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:jsxRuntime.jsx(oe.icon,{className:"h-5 w-5 text-primary"})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h4",{className:"font-semibold text-sm",children:oe.title}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:oe.description})]}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",className:"flex items-center gap-1",onClick:()=>te(oe),children:[jsxRuntime.jsx(Download,{className:"h-4 w-4"}),"Request"]})]},oe.id))]},ge.name))})}),jsxRuntime.jsx(Dialog,{open:Q,onOpenChange:F,children:jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsxs(DialogTitle,{children:["Request ",I==null?void 0:I.title]}),jsxRuntime.jsx(DialogDescription,{children:"Enter the email address where you would like to receive the report."})]}),jsxRuntime.jsxs("div",{className:"py-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",value:q,onChange:ge=>z(ge.target.value),placeholder:"your@email.com",className:"mt-2"})]}),jsxRuntime.jsx(DialogDescription,{children:"The report will take around 5 minutes to generate."}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:ne,disabled:!q||se,children:se?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):"Send Report"})]})]})})]})}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:o,children:l,...d},f)=>jsxRuntime.jsxs("div",{ref:f,className:cn(badgeVariants({variant:e,size:n}),t),...d,children:[o&&jsxRuntime.jsx("span",{className:"mr-1",children:o}),l]}));Badge.displayName="Badge";function QualificationBadge({qualification:t}){return!t.QualificationId||t.QualificationId==="Suspended"?null:t.QualificationId==="Do Not Sell"?jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"destructive",children:[jsxRuntime.jsx(X$1,{className:"h-3 w-3 mr-1"}),"Do Not Sell"]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})}):jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"info",className:t.DefaultOpportunityNumber?"pr-1":"",children:[jsxRuntime.jsx(BadgeCheck,{className:"h-3 w-3 mr-1"}),t.QualificationId,t.DefaultOpportunityNumber&&jsxRuntime.jsx(Badge,{variant:"secondary",size:"sm",className:"ml-1",children:t.DefaultOpportunityNumber})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})})}function SalesChart({statistics:t,mode:e="month",chartHeight:n,loading:o=!1,size:l="default"}){const[d,f]=React.useState([]),[g,b]=React.useState(!1),_=[{name:"dollarVolume",label:"Dollar Volume",color:"var(--primary)",yAxisId:"left",format:"money"},{name:"unitsSold",label:"Units Sold",color:"#888",units:" units",yAxisId:"right",format:"integer"}];return React.useEffect(()=>{if(o||!t){f([]);return}let S=[];if(e==="week"){const R=new Map;t.forEach(C=>{var A;const E=((A=C.Day)==null?void 0:A.toString())||"";if(E.length===8){const M=parseInt(E.substring(0,4),10),I=parseInt(E.substring(4,6),10)-1,j=parseInt(E.substring(6,8),10),q=new Date(M,I,j),z=new Date(q);z.setDate(q.getDate()-q.getDay());const Q=`${z.getFullYear()}-${String(z.getMonth()+1).padStart(2,"0")}-${String(z.getDate()).padStart(2,"0")}`,F=R.get(Q)||{price:0,quantity:0};F.price+=C.ExtendedPrice||0,F.quantity+=C.Quantity||0,R.set(Q,F)}}),S=Array.from(R).sort(([C],[E])=>C.localeCompare(E)).map(([C,E])=>({date:`${C.substring(5,7)}/${C.substring(8,10)}`,dollarVolume:E.price,unitsSold:E.quantity}))}else{const R=new Date,C=R.getFullYear(),E=R.getMonth(),A=R.getDate(),M=`${C}-${(E+1).toString().padStart(2,"0")}`,I=Array.from({length:12},(q,z)=>{const Q=new Date(C,E-(11-z),1);return`${Q.getFullYear()}-${(Q.getMonth()+1).toString().padStart(2,"0")}`}),j=Object.fromEntries(I.map(q=>[q,{price:0,quantity:0}]));if(t.forEach(q=>{const z=String(q.Day??0);if(z.length!==8)return;const Q=`${z.substring(0,4)}-${z.substring(4,6)}`;j.hasOwnProperty(Q)&&(j[Q].price+=q.ExtendedPrice??0,j[Q].quantity+=q.Quantity??0)}),S=I.map(q=>{const z=j[q],[Q,F]=q.split("-").map(Number);return{date:new Date(Q,F-1).toLocaleString("default",{month:"short",year:"numeric"}),dollarVolume:z.price,unitsSold:z.quantity}}),g){const q=j[M];if(q&&q.price>0&&A>0){const z=new Date(C,E+1,0).getDate();if(A<z){const Q=q.price/A,F=q.quantity/A,V=Q*z,te=F*z,ne=S[S.length-1];ne&&(ne.dollarVolume=V,ne.unitsSold=te)}}}}f(S)},[t,e,g,o]),o?jsxRuntime.jsx("div",{style:{height:n},children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full rounded-md"})}):d.length===0?jsxRuntime.jsx("div",{style:{height:n},className:"flex items-center justify-center text-muted-foreground",children:"No sales data available."}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(AreaChart,{data:d,series:_,height:n,size:l}),l==="default"&&e==="month"&&jsxRuntime.jsxs("div",{className:"mt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Switch,{checked:g,onCheckedChange:b,id:"extrapolate-switch"}),jsxRuntime.jsx(Label$2,{htmlFor:"extrapolate-switch",children:"Extrapolate Current Month"})]}),g&&jsxRuntime.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["* Values for ",new Date().toLocaleString("default",{month:"long"})," are projected estimates."]})]})]})}function ManufacturerCard({manufacturer:t,link:e,linkNewTab:n=!0,actions:o,mainAction:l,loading:d=!1}){var S,R,C;if(d||!t)return jsxRuntime.jsxs(Card,{className:"flex flex-col h-full",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]}),jsxRuntime.jsx(Skeleton,{className:"h-16 w-24"})]}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex flex-col space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const f=t.ManufacturerId||"N/A",g=[t.City,t.Province,t.Country].filter(Boolean),b=g.length>0?g.join(", "):"",_=((S=t.Tags)==null?void 0:S.split(",").map(E=>E.trim()).filter(Boolean))||[];return jsxRuntime.jsxs(Card,{className:"manufacturer-theme flex flex-col h-full",children:[jsxRuntime.jsx(reactRouterDom.Link,{to:e??"#",target:e&&n?"_blank":"_self",children:jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx(PartnerLogo,{id:t.ManufacturerId,width:48,height:48})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Manufacturer"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:f})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"}),t.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t.Name}),b&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:b})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:t.SalesStatistics&&t.SalesStatistics.length>0&&jsxRuntime.jsx("div",{className:"h-16 w-24",children:jsxRuntime.jsx(SalesChart,{statistics:t.SalesStatistics,size:"mini"})})})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[(!!((R=t.Qualification)!=null&&R.QualificationId)&&((C=t.Qualification)==null?void 0:C.QualificationId)!=="Suspended"||!!t.OpenToWork||!!t.OnHold&&t.OnHold!==0||_.length>0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(QualificationBadge,{qualification:t.Qualification??{}}),!!t.OpenToWork&&jsxRuntime.jsxs(Badge,{variant:"success",children:[jsxRuntime.jsx(HardHat,{className:"h-3 w-3 mr-1"}),"Open To Work"]}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"}),_.map((E,A)=>jsxRuntime.jsx(Badge,{variant:"outline",children:E},A))]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${t.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${t.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:t.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})]}),t.SalesData&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:t.SalesData.SalesYearToDay?formatMoney(t.SalesData.SalesYearToDay):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:t.SalesData.SalesLast3Months?formatMoney(t.SalesData.SalesLast3Months):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:t.SalesData.SalesLast30Days?formatMoney(t.SalesData.SalesLast30Days):"—"})]})]})}),(o||l||t.PublicResourcesLink)&&jsxRuntime.jsxs(CardFooter,{className:"flex pt-2 gap-2 justify-between mt-auto",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[o&&o,t.PublicResourcesLink&&jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:t.PublicResourcesLink,target:"_blank",children:jsxRuntime.jsx(Button,{size:"icon",children:jsxRuntime.jsx(HardDriveDownload,{className:"h-4 w-4"})})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Public Resources Link"})})]})})]}),l&&jsxRuntime.jsx("div",{children:l})]})]})}function OrdersCard({applicationId:t,orders:e=null,loading:n=!1,title:o="Order Details"}){const l=React.useMemo(()=>[{accessorKey:"DocumentNumber",header:"Document Number",cell:({row:g})=>g.original.DocumentNumber?jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:`/${t}/Document/${g.original.DocumentNumber}`,className:"font-medium text-primary hover:underline",children:g.original.DocumentNumber})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["View details for order ",g.original.DocumentNumber]})})]})}):"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"DocumentDate",header:"Document Date",cell:({row:g})=>formatYYYYMMDDIntToDateString(g.original.DocumentDate),enableSorting:!0,enableFiltering:!1},{accessorKey:"OrderNumber",header:"Order Number",cell:({row:g})=>g.original.OrderNumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"PONumber",header:"PO Number",cell:({row:g})=>g.original.PONumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"WarehouseCode",header:"Warehouse",cell:({row:g})=>g.original.WarehouseCode??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:g})=>g.original.Quantity??"N/A",enableSorting:!0,enableFiltering:!1},{accessorKey:"ShipToName",header:"Name",cell:({row:g})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:g.original.ShipToName??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"UnitPrice",header:"Unit Price",cell:({row:g})=>g.original.UnitPrice?formatMoney(g.original.UnitPrice):"N/A",enableSorting:!0,enableFiltering:!1}],[]),d=React.useMemo(()=>{const g={};if(e){const b=Array.from(new Set(e.map(E=>E.WarehouseCode).filter(E=>E!=null)));g.WarehouseCode=b;const _=Array.from(new Set(e.map(E=>E.ShipToName).filter(E=>E!=null)));g.ShipToName=_;const S=Array.from(new Set(e.map(E=>E.DocumentNumber).filter(E=>E!=null)));g.DocumentNumber=S;const R=Array.from(new Set(e.map(E=>E.OrderNumber).filter(E=>E!=null)));g.OrderNumber=R;const C=Array.from(new Set(e.map(E=>E.PONumber).filter(E=>E!=null)));g.PONumber=C}return g},[e]),f=e||[];return n?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-48"})," "]}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:o})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:l,data:f,uniqueValues:d})})]})}function ResellerOverview({appID:t,reseller:e,readonly:n,userEmail:o,isSuperAdmin:l,withoutReports:d=!1}){const{data:f,isLoading:g,isError:b}=useGetV4PartnerByApplicationIdAccountResellerQuery({applicationId:t??"",withSpecification:!0},{skip:!!e}),[_,S]=React.useState({publicInfo:{hasUnsavedChanges:!1}}),R=React.useCallback(()=>n?!1:_.publicInfo.hasUnsavedChanges,[n,_]),C=React.useCallback((q,z)=>{S(Q=>{var F;return((F=Q[q])==null?void 0:F.hasUnsavedChanges)!==z.hasUnsavedChanges?{...Q,[q]:z}:Q})},[]),{NavigationGuardDialog:E}=useRouterNavigationGuard(R),A=e??f,M=!n||!!(A!=null&&A.Statement)&&(A.Statement.Total??0)>0,I=(A==null?void 0:A.QualifiedManufacturers)??[],j=(A==null?void 0:A.Qualifications)??[];return jsxRuntime.jsxs("div",{className:"@container",children:[b?jsxRuntime.jsx(Card,{className:"p-6",children:jsxRuntime.jsxs(Alert,{variant:"destructive",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Error"}),jsxRuntime.jsx(AlertDescription,{children:"There was an error loading your reseller information. Please try again later."})]})}):jsxRuntime.jsxs("div",{className:"space-y-6 mb-6",children:[jsxRuntime.jsx(SalesSummary,{fiscalYearMonthStart:(A==null?void 0:A.FiscalYearMonthStart)||1,salesData:A==null?void 0:A.SalesData,isLoading:g}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @2xl:grid-cols-2 gap-6",children:[jsxRuntime.jsx(SalesChartCard,{statistics:(A==null?void 0:A.SalesStatistics)??[],loading:g}),jsxRuntime.jsx(OrderCategories,{openOrders:(A==null?void 0:A.ActiveOrderDetails)??[],isLoading:g}),M&&jsxRuntime.jsx(BillingCard,{appID:t,reseller:A||{},withoutReports:d,isLoading:g,userEmail:o}),jsxRuntime.jsx(PublicInfo,{reseller:A||{},appID:t??"",isLoading:g,readonly:n,onUnsavedChanges:q=>C("publicInfo",{hasUnsavedChanges:q})}),jsxRuntime.jsx(AccountTier,{isSuperAdmin:l,readonly:n,reseller:A||{},appID:t??"",isLoading:g})]}),g||I.length>0?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Manufacturers you are qualified for"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid @2xl:grid-cols-2 gap-4",children:g?Array.from({length:2}).map((q,z)=>jsxRuntime.jsx(ManufacturerCard,{loading:!0},z)):I.map(q=>jsxRuntime.jsx(ManufacturerCard,{manufacturer:q,link:`https://dashboard.randmar.io/${t}/Partner/${q.ManufacturerId}`},q.ManufacturerId))})})]}):jsxRuntime.jsx(ResellerQualificationsCard,{qualifications:j}),jsxRuntime.jsx(OpportunitiesTable,{applicationId:t,opportunities:A==null?void 0:A.Opportunities,loading:g}),jsxRuntime.jsx(OrdersCard,{applicationId:t,title:"Active Orders",orders:A==null?void 0:A.ActiveOrderDetails,loading:g}),jsxRuntime.jsx(OrdersCard,{applicationId:t,title:"Completed Orders",orders:A==null?void 0:A.CompletedOrderDetails,loading:g}),jsxRuntime.jsx(ReturnsTable,{applicationId:t,returns:A==null?void 0:A.Returns,loading:g}),!d&&jsxRuntime.jsx(ReportsSection,{appID:t,userEmail:o,isLoading:g})]}),jsxRuntime.jsx(E,{})]})}const alertVariants=cva("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",success:"border-green-500/50 bg-green-50 text-green-700 dark:border-green-500 dark:bg-green-950 dark:text-green-400 [&>svg]:text-green-500",warning:"border-yellow-500/50 bg-yellow-50 text-yellow-700 dark:border-yellow-500 dark:bg-yellow-950 dark:text-yellow-400 [&>svg]:text-yellow-500",info:"border-blue-500/50 bg-blue-50 text-blue-700 dark:border-blue-500 dark:bg-blue-950 dark:text-blue-400 [&>svg]:text-blue-500"}},defaultVariants:{variant:"default"}}),Alert=React__namespace.forwardRef(({className:t,variant:e,...n},o)=>jsxRuntime.jsx("div",{ref:o,role:"alert",className:cn(alertVariants({variant:e}),t),...n}));Alert.displayName="Alert";const AlertTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("h5",{ref:n,className:cn("mb-1 font-medium leading-none tracking-tight",t),...e}));AlertTitle.displayName="AlertTitle";const AlertDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("text-sm [&_p]:leading-relaxed",t),...e}));AlertDescription.displayName="AlertDescription";/**
1080
1080
  * table-core
1081
1081
  *
1082
1082
  * Copyright (c) TanStack
@@ -1135,7 +1135,7 @@ Defaulting to 2020, but this will stop working in the future.`)),e.ecmaVersion=1
1135
1135
  Use <ProductCard product={data} applicationId={applicationId}>`],basicComponents=["<Card> <CardHeader> <CardTitle>...</CardTitle> <CardDescription>...</CardDescription> </CardHeader> <CardContent> ... </CardContent> </Card>","<Badge>...</Badge>",'<Tabs defaultValue="eg1"> <TabsList> <TabsTrigger value="eg1">Example1</TabsTrigger> <TabsTrigger value="eg2">Example2</TabsTrigger> </TabsList> <TabsContent value="eg1"> ... </TabsContent> <TabsContent value="eg2"> ... </TabsContent> </Tabs>',"<ScrollArea>...</ScrollArea>","<ScrollArea orientation='horizontal'>...</ScrollArea>"],GetJSXFromAI=async(t,e,n,o,l=3)=>{const d="In addition to basic html tags, You have access to these beautiful Handmade Components. Try to use them even when you get an array of search results. For example, use ProductCard when ContentType is Product:",f="You also have access to these few Shadcn UI components:",g='Here is the data to display to the user (If a Handmade Component is a good fit for the data, use it. Otherwise, use regular html tags) (You have access to this data object in React via the data variable. Do not use JSON.parse, it is already parsed. For example, if data is an array, you can use {data.map(item, idx => <>...</>)} directly. CAUTION: when using map, you must use implicit return rather than a block body, as shown before. AGAIN: never use JSON.parse - data is already parsed and never a block body with arrow functions such as: (item => { return "EXAMPLE - DO NOT DO THIS" }):',b="Only output a single JSX code snippet. Start with <> and end with </>. All other code will be ignored, so make sure to place all CSS styles inline. Use CSS flex layouts when there is a lot of stuff to display.",_=JSON.stringify(n),S=[e,d,...complexComponents,f,...basicComponents,b,g,_,b].join(`\r
1136
1136
  `),E=await new GoogleGenAI({apiKey:t}).chats.create({model:o?"gemini-2.5-pro-preview-03-25":"gemini-2.0-flash-lite"}).sendMessage({message:S}),A=trimJSXString(E.text??"");return A&&!containsBlockArrowFunc(A)?A:l==0?"<p>Could not generate visuals for this data.</p>":await GetJSXFromAI(t,e,n,o,l-1)};function containsBlockArrowFunc(t){return t.replace(/\s+/g,"").indexOf("=>{")>=0}function trimJSXString(t){const e=t.indexOf("<"),n=t.lastIndexOf("</");return e===-1||n===-1?"":t.slice(e,t.indexOf(">",n)+1)}function AiGeneratedContent(t){const[e,n]=React.useState(""),{apiKey:o}=useGeminiApiKey();return React.useEffect(()=>{if(!o||!t.prompt||!t.data)return;n("");let l=!1;return GetJSXFromAI(o,t.prompt,t.data,t.smartAndSlow===!0).then(d=>{l||n(d)}),()=>{l=!0}},[t.prompt,t.data,n,o,t.smartAndSlow]),e?jsxRuntime.jsx(source_default,{bindings:{data:t.data},components:{ResellerCard,ManufacturerCard,PartnerCard,ProductCard,Card,CardHeader,CardTitle,CardContent,CardDescription,Badge,Tabs,TabsList,TabsContent,TabsTrigger,ScrollArea},jsx:e}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(Skeleton,{className:"h-32 w-32",children:jsxRuntime.jsx(Bot,{className:"m-auto align-middle h-full"})})})}var CHECKBOX_NAME="Checkbox",[createCheckboxContext,createCheckboxScope]=createContextScope(CHECKBOX_NAME),[CheckboxProviderImpl,useCheckboxContext]=createCheckboxContext(CHECKBOX_NAME);function CheckboxProvider(t){const{__scopeCheckbox:e,checked:n,children:o,defaultChecked:l,disabled:d,form:f,name:g,onCheckedChange:b,required:_,value:S="on",internal_do_not_use_render:R}=t,[C,E]=useControllableState({prop:n,defaultProp:l??!1,onChange:b,caller:CHECKBOX_NAME}),[A,M]=React__namespace.useState(null),[I,j]=React__namespace.useState(null),q=React__namespace.useRef(!1),z=A?!!f||!!A.closest("form"):!0,Q={checked:C,disabled:d,setChecked:E,control:A,setControl:M,name:g,form:f,value:S,hasConsumerStoppedPropagationRef:q,required:_,defaultChecked:isIndeterminate(l)?!1:l,isFormControl:z,bubbleInput:I,setBubbleInput:j};return jsxRuntime.jsx(CheckboxProviderImpl,{scope:e,...Q,children:isFunction$1(R)?R(Q):o})}var TRIGGER_NAME$3="CheckboxTrigger",CheckboxTrigger=React__namespace.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:n,...o},l)=>{const{control:d,value:f,disabled:g,checked:b,required:_,setControl:S,setChecked:R,hasConsumerStoppedPropagationRef:C,isFormControl:E,bubbleInput:A}=useCheckboxContext(TRIGGER_NAME$3,t),M=useComposedRefs(l,S),I=React__namespace.useRef(b);return React__namespace.useEffect(()=>{const j=d==null?void 0:d.form;if(j){const q=()=>R(I.current);return j.addEventListener("reset",q),()=>j.removeEventListener("reset",q)}},[d,R]),jsxRuntime.jsx(Primitive.button,{type:"button",role:"checkbox","aria-checked":isIndeterminate(b)?"mixed":b,"aria-required":_,"data-state":getState$1(b),"data-disabled":g?"":void 0,disabled:g,value:f,...o,ref:M,onKeyDown:composeEventHandlers(e,j=>{j.key==="Enter"&&j.preventDefault()}),onClick:composeEventHandlers(n,j=>{R(q=>isIndeterminate(q)?!0:!q),A&&E&&(C.current=j.isPropagationStopped(),C.current||j.stopPropagation())})})});CheckboxTrigger.displayName=TRIGGER_NAME$3;var Checkbox$1=React__namespace.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:o,checked:l,defaultChecked:d,required:f,disabled:g,value:b,onCheckedChange:_,form:S,...R}=t;return jsxRuntime.jsx(CheckboxProvider,{__scopeCheckbox:n,checked:l,defaultChecked:d,disabled:g,required:f,onCheckedChange:_,name:o,form:S,value:b,internal_do_not_use_render:({isFormControl:C})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(CheckboxTrigger,{...R,ref:e,__scopeCheckbox:n}),C&&jsxRuntime.jsx(CheckboxBubbleInput,{__scopeCheckbox:n})]})})});Checkbox$1.displayName=CHECKBOX_NAME;var INDICATOR_NAME="CheckboxIndicator",CheckboxIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:o,...l}=t,d=useCheckboxContext(INDICATOR_NAME,n);return jsxRuntime.jsx(Presence,{present:o||isIndeterminate(d.checked)||d.checked===!0,children:jsxRuntime.jsx(Primitive.span,{"data-state":getState$1(d.checked),"data-disabled":d.disabled?"":void 0,...l,ref:e,style:{pointerEvents:"none",...t.style}})})});CheckboxIndicator.displayName=INDICATOR_NAME;var BUBBLE_INPUT_NAME$1="CheckboxBubbleInput",CheckboxBubbleInput=React__namespace.forwardRef(({__scopeCheckbox:t,...e},n)=>{const{control:o,hasConsumerStoppedPropagationRef:l,checked:d,defaultChecked:f,required:g,disabled:b,name:_,value:S,form:R,bubbleInput:C,setBubbleInput:E}=useCheckboxContext(BUBBLE_INPUT_NAME$1,t),A=useComposedRefs(n,E),M=usePrevious(d),I=useSize(o);React__namespace.useEffect(()=>{const q=C;if(!q)return;const z=window.HTMLInputElement.prototype,F=Object.getOwnPropertyDescriptor(z,"checked").set,V=!l.current;if(M!==d&&F){const te=new Event("click",{bubbles:V});q.indeterminate=isIndeterminate(d),F.call(q,isIndeterminate(d)?!1:d),q.dispatchEvent(te)}},[C,M,d,l]);const j=React__namespace.useRef(isIndeterminate(d)?!1:d);return jsxRuntime.jsx(Primitive.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??j.current,required:g,disabled:b,name:_,value:S,form:R,...e,tabIndex:-1,ref:A,style:{...e.style,...I,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});CheckboxBubbleInput.displayName=BUBBLE_INPUT_NAME$1;function isFunction$1(t){return typeof t=="function"}function isIndeterminate(t){return t==="indeterminate"}function getState$1(t){return isIndeterminate(t)?"indeterminate":t?"checked":"unchecked"}const Checkbox=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Checkbox$1,{ref:n,className:cn("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:jsxRuntime.jsx(CheckboxIndicator,{className:cn("flex items-center justify-center text-current"),children:jsxRuntime.jsx(Check,{className:"h-4 w-4"})})}));Checkbox.displayName=Checkbox$1.displayName;var U=1,Y$1=.9,H=.8,J=.17,p=.1,u=.999,$=.9999,k$1=.99,m=/[\\\/_+.#"@\[\(\{&]/,B$1=/[\\\/_+.#"@\[\(\{&]/g,K$1=/[\s-]/,X=/[\s-]/g;function G(t,e,n,o,l,d,f){if(d===e.length)return l===t.length?U:k$1;var g=`${l},${d}`;if(f[g]!==void 0)return f[g];for(var b=o.charAt(d),_=n.indexOf(b,l),S=0,R,C,E,A;_>=0;)R=G(t,e,n,o,_+1,d+1,f),R>S&&(_===l?R*=U:m.test(t.charAt(_-1))?(R*=H,E=t.slice(l,_-1).match(B$1),E&&l>0&&(R*=Math.pow(u,E.length))):K$1.test(t.charAt(_-1))?(R*=Y$1,A=t.slice(l,_-1).match(X),A&&l>0&&(R*=Math.pow(u,A.length))):(R*=J,l>0&&(R*=Math.pow(u,_-l))),t.charAt(_)!==e.charAt(d)&&(R*=$)),(R<p&&n.charAt(_-1)===o.charAt(d+1)||o.charAt(d+1)===o.charAt(d)&&n.charAt(_-1)!==o.charAt(d))&&(C=G(t,e,n,o,_+1,d+2,f),C*p>R&&(R=C*p)),R>S&&(S=R),_=n.indexOf(b,_+1);return f[g]=S,S}function D(t){return t.toLowerCase().replace(X," ")}function W(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,G(t,e,D(t),D(e),0,0,{})}var N='[cmdk-group=""]',Y='[cmdk-group-items=""]',be='[cmdk-group-heading=""]',le='[cmdk-item=""]',ce=`${le}:not([aria-disabled="true"])`,Z="cmdk-item-select",T="data-value",Re=(t,e,n)=>W(t,e,n),ue=React__namespace.createContext(void 0),K=()=>React__namespace.useContext(ue),de=React__namespace.createContext(void 0),ee=()=>React__namespace.useContext(de),fe=React__namespace.createContext(void 0),me=React__namespace.forwardRef((t,e)=>{let n=L(()=>{var He,Ze;return{search:"",value:(Ze=(He=t.value)!=null?He:t.defaultValue)!=null?Ze:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=L(()=>new Set),l=L(()=>new Map),d=L(()=>new Map),f=L(()=>new Set),g=pe(t),{label:b,children:_,value:S,onValueChange:R,filter:C,shouldFilter:E,loop:A,disablePointerSelection:M=!1,vimBindings:I=!0,...j}=t,q=useId(),z=useId(),Q=useId(),F=React__namespace.useRef(null),V=ke();k(()=>{if(S!==void 0){let He=S.trim();n.current.value=He,te.emit()}},[S]),k(()=>{V(6,je)},[]);let te=React__namespace.useMemo(()=>({subscribe:He=>(f.current.add(He),()=>f.current.delete(He)),snapshot:()=>n.current,setState:(He,Ze,tt)=>{var Ye,Qe,Xe,st;if(!Object.is(n.current[He],Ze)){if(n.current[He]=Ze,He==="search")Ae(),ge(),V(1,oe);else if(He==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let rt=document.getElementById(Q);rt?rt.focus():(Ye=document.getElementById(q))==null||Ye.focus()}if(V(7,()=>{var rt;n.current.selectedItemId=(rt=Ne())==null?void 0:rt.id,te.emit()}),tt||V(5,je),((Qe=g.current)==null?void 0:Qe.value)!==void 0){let rt=Ze??"";(st=(Xe=g.current).onValueChange)==null||st.call(Xe,rt);return}}te.emit()}},emit:()=>{f.current.forEach(He=>He())}}),[]),ne=React__namespace.useMemo(()=>({value:(He,Ze,tt)=>{var Ye;Ze!==((Ye=d.current.get(He))==null?void 0:Ye.value)&&(d.current.set(He,{value:Ze,keywords:tt}),n.current.filtered.items.set(He,se(Ze,tt)),V(2,()=>{ge(),te.emit()}))},item:(He,Ze)=>(o.current.add(He),Ze&&(l.current.has(Ze)?l.current.get(Ze).add(He):l.current.set(Ze,new Set([He]))),V(3,()=>{Ae(),ge(),n.current.value||oe(),te.emit()}),()=>{d.current.delete(He),o.current.delete(He),n.current.filtered.items.delete(He);let tt=Ne();V(4,()=>{Ae(),(tt==null?void 0:tt.getAttribute("id"))===He&&oe(),te.emit()})}),group:He=>(l.current.has(He)||l.current.set(He,new Set),()=>{d.current.delete(He),l.current.delete(He)}),filter:()=>g.current.shouldFilter,label:b||t["aria-label"],getDisablePointerSelection:()=>g.current.disablePointerSelection,listId:q,inputId:Q,labelId:z,listInnerRef:F}),[]);function se(He,Ze){var tt,Ye;let Qe=(Ye=(tt=g.current)==null?void 0:tt.filter)!=null?Ye:Re;return He?Qe(He,n.current.search,Ze):0}function ge(){if(!n.current.search||g.current.shouldFilter===!1)return;let He=n.current.filtered.items,Ze=[];n.current.filtered.groups.forEach(Ye=>{let Qe=l.current.get(Ye),Xe=0;Qe.forEach(st=>{let rt=He.get(st);Xe=Math.max(rt,Xe)}),Ze.push([Ye,Xe])});let tt=F.current;Oe().sort((Ye,Qe)=>{var Xe,st;let rt=Ye.getAttribute("id"),at=Qe.getAttribute("id");return((Xe=He.get(at))!=null?Xe:0)-((st=He.get(rt))!=null?st:0)}).forEach(Ye=>{let Qe=Ye.closest(Y);Qe?Qe.appendChild(Ye.parentElement===Qe?Ye:Ye.closest(`${Y} > *`)):tt.appendChild(Ye.parentElement===tt?Ye:Ye.closest(`${Y} > *`))}),Ze.sort((Ye,Qe)=>Qe[1]-Ye[1]).forEach(Ye=>{var Qe;let Xe=(Qe=F.current)==null?void 0:Qe.querySelector(`${N}[${T}="${encodeURIComponent(Ye[0])}"]`);Xe==null||Xe.parentElement.appendChild(Xe)})}function oe(){let He=Oe().find(tt=>tt.getAttribute("aria-disabled")!=="true"),Ze=He==null?void 0:He.getAttribute(T);te.setState("value",Ze||void 0)}function Ae(){var He,Ze,tt,Ye;if(!n.current.search||g.current.shouldFilter===!1){n.current.filtered.count=o.current.size;return}n.current.filtered.groups=new Set;let Qe=0;for(let Xe of o.current){let st=(Ze=(He=d.current.get(Xe))==null?void 0:He.value)!=null?Ze:"",rt=(Ye=(tt=d.current.get(Xe))==null?void 0:tt.keywords)!=null?Ye:[],at=se(st,rt);n.current.filtered.items.set(Xe,at),at>0&&Qe++}for(let[Xe,st]of l.current)for(let rt of st)if(n.current.filtered.items.get(rt)>0){n.current.filtered.groups.add(Xe);break}n.current.filtered.count=Qe}function je(){var He,Ze,tt;let Ye=Ne();Ye&&(((He=Ye.parentElement)==null?void 0:He.firstChild)===Ye&&((tt=(Ze=Ye.closest(N))==null?void 0:Ze.querySelector(be))==null||tt.scrollIntoView({block:"nearest"})),Ye.scrollIntoView({block:"nearest"}))}function Ne(){var He;return(He=F.current)==null?void 0:He.querySelector(`${le}[aria-selected="true"]`)}function Oe(){var He;return Array.from(((He=F.current)==null?void 0:He.querySelectorAll(ce))||[])}function Fe(He){let Ze=Oe()[He];Ze&&te.setState("value",Ze.getAttribute(T))}function ze(He){var Ze;let tt=Ne(),Ye=Oe(),Qe=Ye.findIndex(st=>st===tt),Xe=Ye[Qe+He];(Ze=g.current)!=null&&Ze.loop&&(Xe=Qe+He<0?Ye[Ye.length-1]:Qe+He===Ye.length?Ye[0]:Ye[Qe+He]),Xe&&te.setState("value",Xe.getAttribute(T))}function $e(He){let Ze=Ne(),tt=Ze==null?void 0:Ze.closest(N),Ye;for(;tt&&!Ye;)tt=He>0?we(tt,N):De(tt,N),Ye=tt==null?void 0:tt.querySelector(ce);Ye?te.setState("value",Ye.getAttribute(T)):ze(He)}let Be=()=>Fe(Oe().length-1),qe=He=>{He.preventDefault(),He.metaKey?Be():He.altKey?$e(1):ze(1)},Ge=He=>{He.preventDefault(),He.metaKey?Fe(0):He.altKey?$e(-1):ze(-1)};return React__namespace.createElement(Primitive.div,{ref:e,tabIndex:-1,...j,"cmdk-root":"",onKeyDown:He=>{var Ze;(Ze=j.onKeyDown)==null||Ze.call(j,He);let tt=He.nativeEvent.isComposing||He.keyCode===229;if(!(He.defaultPrevented||tt))switch(He.key){case"n":case"j":{I&&He.ctrlKey&&qe(He);break}case"ArrowDown":{qe(He);break}case"p":case"k":{I&&He.ctrlKey&&Ge(He);break}case"ArrowUp":{Ge(He);break}case"Home":{He.preventDefault(),Fe(0);break}case"End":{He.preventDefault(),Be();break}case"Enter":{He.preventDefault();let Ye=Ne();if(Ye){let Qe=new Event(Z);Ye.dispatchEvent(Qe)}}}}},React__namespace.createElement("label",{"cmdk-label":"",htmlFor:ne.inputId,id:ne.labelId,style:Te},b),B(t,He=>React__namespace.createElement(de.Provider,{value:te},React__namespace.createElement(ue.Provider,{value:ne},He))))}),he=React__namespace.forwardRef((t,e)=>{var n,o;let l=useId(),d=React__namespace.useRef(null),f=React__namespace.useContext(fe),g=K(),b=pe(t),_=(o=(n=b.current)==null?void 0:n.forceMount)!=null?o:f==null?void 0:f.forceMount;k(()=>{if(!_)return g.item(l,f==null?void 0:f.id)},[_]);let S=ve(l,d,[t.value,t.children,d],t.keywords),R=ee(),C=P(V=>V.value&&V.value===S.current),E=P(V=>_||g.filter()===!1?!0:V.search?V.filtered.items.get(l)>0:!0);React__namespace.useEffect(()=>{let V=d.current;if(!(!V||t.disabled))return V.addEventListener(Z,A),()=>V.removeEventListener(Z,A)},[E,t.onSelect,t.disabled]);function A(){var V,te;M(),(te=(V=b.current).onSelect)==null||te.call(V,S.current)}function M(){R.setState("value",S.current,!0)}if(!E)return null;let{disabled:I,value:j,onSelect:q,forceMount:z,keywords:Q,...F}=t;return React__namespace.createElement(Primitive.div,{ref:composeRefs(d,e),...F,id:l,"cmdk-item":"",role:"option","aria-disabled":!!I,"aria-selected":!!C,"data-disabled":!!I,"data-selected":!!C,onPointerMove:I||g.getDisablePointerSelection()?void 0:M,onClick:I?void 0:A},t.children)}),Ee=React__namespace.forwardRef((t,e)=>{let{heading:n,children:o,forceMount:l,...d}=t,f=useId(),g=React__namespace.useRef(null),b=React__namespace.useRef(null),_=useId(),S=K(),R=P(E=>l||S.filter()===!1?!0:E.search?E.filtered.groups.has(f):!0);k(()=>S.group(f),[]),ve(f,g,[t.value,t.heading,b]);let C=React__namespace.useMemo(()=>({id:f,forceMount:l}),[l]);return React__namespace.createElement(Primitive.div,{ref:composeRefs(g,e),...d,"cmdk-group":"",role:"presentation",hidden:R?void 0:!0},n&&React__namespace.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":!0,id:_},n),B(t,E=>React__namespace.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?_:void 0},React__namespace.createElement(fe.Provider,{value:C},E))))}),ye=React__namespace.forwardRef((t,e)=>{let{alwaysRender:n,...o}=t,l=React__namespace.useRef(null),d=P(f=>!f.search);return!n&&!d?null:React__namespace.createElement(Primitive.div,{ref:composeRefs(l,e),...o,"cmdk-separator":"",role:"separator"})}),Se=React__namespace.forwardRef((t,e)=>{let{onValueChange:n,...o}=t,l=t.value!=null,d=ee(),f=P(_=>_.search),g=P(_=>_.selectedItemId),b=K();return React__namespace.useEffect(()=>{t.value!=null&&d.setState("search",t.value)},[t.value]),React__namespace.createElement(Primitive.input,{ref:e,...o,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":g,id:b.inputId,type:"text",value:l?t.value:f,onChange:_=>{l||d.setState("search",_.target.value),n==null||n(_.target.value)}})}),Ce=React__namespace.forwardRef((t,e)=>{let{children:n,label:o="Suggestions",...l}=t,d=React__namespace.useRef(null),f=React__namespace.useRef(null),g=P(_=>_.selectedItemId),b=K();return React__namespace.useEffect(()=>{if(f.current&&d.current){let _=f.current,S=d.current,R,C=new ResizeObserver(()=>{R=requestAnimationFrame(()=>{let E=_.offsetHeight;S.style.setProperty("--cmdk-list-height",E.toFixed(1)+"px")})});return C.observe(_),()=>{cancelAnimationFrame(R),C.unobserve(_)}}},[]),React__namespace.createElement(Primitive.div,{ref:composeRefs(d,e),...l,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":g,"aria-label":o,id:b.listId},B(t,_=>React__namespace.createElement("div",{ref:composeRefs(f,b.listInnerRef),"cmdk-list-sizer":""},_)))}),xe=React__namespace.forwardRef((t,e)=>{let{open:n,onOpenChange:o,overlayClassName:l,contentClassName:d,container:f,...g}=t;return React__namespace.createElement(Root$8,{open:n,onOpenChange:o},React__namespace.createElement(Portal$4,{container:f},React__namespace.createElement(Overlay,{"cmdk-overlay":"",className:l}),React__namespace.createElement(Content$2,{"aria-label":t.label,"cmdk-dialog":"",className:d},React__namespace.createElement(me,{ref:e,...g}))))}),Ie=React__namespace.forwardRef((t,e)=>P(n=>n.filtered.count===0)?React__namespace.createElement(Primitive.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),Pe=React__namespace.forwardRef((t,e)=>{let{progress:n,children:o,label:l="Loading...",...d}=t;return React__namespace.createElement(Primitive.div,{ref:e,...d,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":l},B(t,f=>React__namespace.createElement("div",{"aria-hidden":!0},f)))}),_e=Object.assign(me,{List:Ce,Item:he,Input:Se,Group:Ee,Separator:ye,Dialog:xe,Empty:Ie,Loading:Pe});function we(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function De(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function pe(t){let e=React__namespace.useRef(t);return k(()=>{e.current=t}),e}var k=typeof window>"u"?React__namespace.useEffect:React__namespace.useLayoutEffect;function L(t){let e=React__namespace.useRef();return e.current===void 0&&(e.current=t()),e}function P(t){let e=ee(),n=()=>t(e.snapshot());return React__namespace.useSyncExternalStore(e.subscribe,n,n)}function ve(t,e,n,o=[]){let l=React__namespace.useRef(),d=K();return k(()=>{var f;let g=(()=>{var _;for(let S of n){if(typeof S=="string")return S.trim();if(typeof S=="object"&&"current"in S)return S.current?(_=S.current.textContent)==null?void 0:_.trim():l.current}})(),b=o.map(_=>_.trim());d.value(t,g,b),(f=e.current)==null||f.setAttribute(T,g),l.current=g}),l}var ke=()=>{let[t,e]=React__namespace.useState(),n=L(()=>new Map);return k(()=>{n.current.forEach(o=>o()),n.current=new Map},[t]),(o,l)=>{n.current.set(o,l),e({})}};function Me(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function B({asChild:t,children:e},n){return t&&React__namespace.isValidElement(e)?React__namespace.cloneElement(Me(e),{ref:e.ref},n(e.props.children)):n(e)}var Te={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Command=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(_e,{ref:n,className:cn("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));Command.displayName=_e.displayName;const CommandDialog=({children:t,...e})=>jsxRuntime.jsx(Dialog,{...e,children:jsxRuntime.jsx(DialogContent,{className:"overflow-hidden p-0",children:jsxRuntime.jsx(Command,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:t})})}),CommandInput=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[jsxRuntime.jsx(Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),jsxRuntime.jsx(_e.Input,{ref:n,className:cn("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));CommandInput.displayName=_e.Input.displayName;const CommandList=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(_e.List,{ref:n,className:cn("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));CommandList.displayName=_e.List.displayName;const CommandEmpty=React__namespace.forwardRef((t,e)=>jsxRuntime.jsx(_e.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));CommandEmpty.displayName=_e.Empty.displayName;const CommandGroup=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(_e.Group,{ref:n,className:cn("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...e}));CommandGroup.displayName=_e.Group.displayName;const CommandSeparator=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(_e.Separator,{ref:n,className:cn("-mx-1 h-px bg-border",t),...e}));CommandSeparator.displayName=_e.Separator.displayName;const CommandItem=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(_e.Item,{ref:n,className:cn("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...e}));CommandItem.displayName=_e.Item.displayName;const CommandShortcut=({className:t,...e})=>jsxRuntime.jsx("span",{className:cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});CommandShortcut.displayName="CommandShortcut";function GeneralDocumentCard({document:t,loading:e=!1}){return e?jsxRuntime.jsx("div",{children:"loading..."}):jsxRuntime.jsxs("div",{children:["GENERAL DOCUMENT CARD - ",t==null?void 0:t.OrderNumber," for P.O. ",t==null?void 0:t.PONumber]})}const Navbar=React.forwardRef(({routes:t,footer:e,dashboardTitle:n,withRandmarAssistant:o,chatUserName:l,appID:d},f)=>{const g=t.filter(C=>C.showInNav),b=React.useRef(null),_=React.useRef(null),S=React.useRef(null),{data:R}=useGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationsHasUnreadsQuery({routeApplicationId:d});return React.useImperativeHandle(f,()=>({setActiveChatAndSendMessage:(C,E)=>{var A;(A=S.current)==null||A.click(),setTimeout(()=>{var M;(M=b.current)==null||M.focus(),_.current&&_.current.setActiveChatAndSendMessage(C,E)},100)}})),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:g.map(C=>{const E=C.icon,A=`/${C.path}`;return jsxRuntime.jsx(SidebarMenuItem,{children:jsxRuntime.jsx(SidebarMenuButton,{asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:A,className:"transition-colors hover:bg-muted px-6",children:[E&&jsxRuntime.jsx(E,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:C.label})]})})},C.key)})})}),jsxRuntime.jsxs(SidebarFooter,{className:"border-t border-sidebar-border p-4 bg-sidebar-background text-sidebar-foreground",children:[o===!0&&jsxRuntime.jsxs(Dialog,{children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{ref:S,size:"lg",className:"collapse md:visible flex-grow",onClick:()=>setTimeout(()=>{var C;return(C=b.current)==null?void 0:C.focus()},50),children:[jsxRuntime.jsx(Bot,{}),"Assistant"]})}),(R==null?void 0:R.HasUnreads)===!0&&jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{size:"icon",className:"pulse-glow bg-white hover:bg-gray-200 text-black collapse md:visible",onClick:()=>setTimeout(()=>{var C;return(C=b.current)==null?void 0:C.focus()},50),children:jsxRuntime.jsx(MessageSquare,{className:"h-5 w-5"})})})]}),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,{className:"h-[85vh]",ref:_,inputRef:b,userId:d,userName:l??"Unknown user"})})]}),e]})]})}),Layout=React.forwardRef(({children:t,appID:e,rightMenu:n,routes:o,footer:l,handleValidSearch:d,dashboardTitle:f,onSignOut:g,searchPlaceholder:b,withRandmarAssistant:_,chatUserName:S,chatRef:R},C)=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(SidebarProvider,{children:jsxRuntime.jsxs("div",{className:"flex grow",children:[jsxRuntime.jsx(Navbar,{appID:e,routes:o,footer:l,dashboardTitle:f,withRandmarAssistant:_,chatUserName:S,ref:R}),jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col",children:[jsxRuntime.jsx(Topbar,{ref:C,onSignOut:g,rightMenu:n,handleValidSearch:d,searchPlaceholder:b}),jsxRuntime.jsx("main",{className:"flex-1 mt-16",children:t}),jsxRuntime.jsx(Toaster,{})]})]})})}));Layout.displayName="Layout";const salesChannels=[{id:"online-store",label:"Online store (Shopify, Amazon, etc.)"},{id:"brick-and-mortar",label:"Brick-and-mortar (Physical Store)"},{id:"marketplace",label:"Marketplace seller (eBay, Walmart, etc.)"},{id:"b2b",label:"B2B wholesale"},{id:"other-channel",label:"Other (please specify)"}],markets=[{id:"canada",label:"Canada - Nationwide"},{id:"ontario",label:"Ontario & Quebec"},{id:"atlantic",label:"Atlantic Provinces (NS, NB, PEI, NL)"},{id:"prairie",label:"Prairie (Saskatchewan, Manitoba)"},{id:"western",label:"Western Provinces (BC, Alberta, etc.)"},{id:"united-states",label:"United States"},{id:"other-market",label:"Other (please specify)"}];function ManufacturerGetStartedButton({applicationId:t,manufacturer:e}){const{toast:n}=useToast(),[o,l]=React.useState(!1),[d,f]=React.useState(!1),[g,b]=React.useState(!1),[_,S]=React.useState(""),[R,C]=React.useState(""),[E,A]=React.useState(!1),[M,I]=React.useState(""),[j,q]=React.useState(""),[z,Q]=React.useState([]),[F,V]=React.useState(""),[te,ne]=React.useState(""),[se,ge]=React.useState([]),[oe,Ae]=React.useState(""),[je,Ne]=React.useState(""),[Oe]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),{sendMessage:Fe}=useChat(),ze=()=>{S(""),C("")},$e=()=>{I(""),q(""),Q([]),V(""),ne(""),ge([]),Ae(""),Ne("")},Be=()=>{e.PartnerRegistrationLink?l(!0):e.OpenToWork&&f(!0)},qe=Qe=>{if(Qe.preventDefault(),!g){if(!_.trim()){C("Qualification ID is required");return}b(!0),Oe({routeApplicationId:t,partnerId:e.ManufacturerId??"",message:`Hello! I'd like to get started with you. Here's my Qualification ID: ${_}`}).then(Xe=>{var rt;if(Xe.error){console.error(Xe.error),n({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"});return}const st=(rt=Xe.data)==null?void 0:rt.ConversationId;st&&Fe(st)?(l(!1),ze()):n({title:"Could not send message",description:"Try again later.",variant:"destructive"})}).catch(Xe=>{console.error(Xe),n({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"})}).finally(()=>{b(!1)})}},Ge=Qe=>{if(Qe.preventDefault(),E)return;q(""),V(""),Ae("");let Xe=!1;if(M.trim().length<10&&(q("Please provide a brief description of your business (minimum 10 characters)"),Xe=!0),z.length===0&&(V("Please select at least one sales channel"),Xe=!0),se.length===0&&(Ae("Please select at least one market"),Xe=!0),Xe)return;const st=salesChannels.filter(ot=>z.includes(ot.id)).map(ot=>ot.label);te&&st.push(`Other: ${te}`);const rt=markets.filter(ot=>se.includes(ot.id)).map(ot=>ot.label);je&&rt.push(`Other: ${je}`);const at=["Hello! I'd like to introduce my business:",`**Business Description:** ${M}`,`**Sales Channels:** ${st.join(", ")}`,`**Markets:** ${rt.join(", ")}`].join(`
1137
1137
 
1138
- `);A(!0),Oe({routeApplicationId:t,partnerId:e.ManufacturerId??"",message:at}).then(ot=>{var Ct;if(ot.error){console.error(ot.error),n({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"});return}const Ue=(Ct=ot.data)==null?void 0:Ct.ConversationId;Ue&&Fe(Ue)?(f(!1),$e()):n({title:"Could not send message",description:"Try again later.",variant:"destructive"})}).catch(ot=>{console.error(ot),n({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"})}).finally(()=>{A(!1)})},He=(Qe,Xe)=>{Q(st=>Xe?[...st,Qe]:st.filter(rt=>rt!==Qe)),V("")},Ze=(Qe,Xe)=>{ge(st=>Xe?[...st,Qe]:st.filter(rt=>rt!==Qe)),Ae("")},tt=z.includes("other-channel"),Ye=se.includes("other-market");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!e.Qualification&&jsxRuntime.jsxs(Button,{onClick:Be,disabled:!e.PartnerRegistrationLink&&!e.OpenToWork,children:[jsxRuntime.jsx(Check,{className:"mr-2 h-4 w-4"}),"Get Started"]}),e.PartnerRegistrationLink&&jsxRuntime.jsx(Dialog,{open:o,onOpenChange:Qe=>{l(Qe)},children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[400px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:e.PublicName}),jsxRuntime.jsxs(DialogDescription,{children:[jsxRuntime.jsx("span",{className:"font-bold",children:"Already qualified?"})," Provide your Qualification ID."]})]}),jsxRuntime.jsxs("form",{onSubmit:qe,className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"qualificationId",children:"Qualification ID"}),jsxRuntime.jsx(Input,{id:"qualificationId",placeholder:"Enter your qualification ID",value:_,onChange:Qe=>{S(Qe.target.value),C("")}}),R&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:R})]}),jsxRuntime.jsx(DialogFooter,{children:jsxRuntime.jsx(Button,{type:"submit",className:"w-full",disabled:g,children:g?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Applying..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Check,{className:"mr-2 h-4 w-4"}),"Apply for Qualification"]})})})]}),jsxRuntime.jsx(Separator$1,{className:"my-4"}),jsxRuntime.jsxs("div",{className:"text-center space-y-2",children:[jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Don't have a qualification ID?"}),jsxRuntime.jsx("a",{href:e.PartnerRegistrationLink,target:"_blank",rel:"noopener noreferrer",children:jsxRuntime.jsxs(Button,{variant:"outline",className:"w-full",disabled:!e.PartnerRegistrationLink,children:[jsxRuntime.jsx(ExternalLink,{className:"mr-2 h-4 w-4"}),"Register here"]})})]})]})}),jsxRuntime.jsx(Dialog,{open:d,onOpenChange:Qe=>{f(Qe)},children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[768px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsx(DialogTitle,{children:"Introduce Yourself"})}),jsxRuntime.jsxs("form",{onSubmit:Ge,className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs(Label$2,{htmlFor:"businessDescription",children:["Tell Us About Your Business ",jsxRuntime.jsx("span",{className:"text-sm text-muted-foreground",children:"(Briefly describe your business)"})]}),jsxRuntime.jsx(Textarea,{id:"businessDescription",placeholder:"We are an online retailer specializing in office supplies, serving businesses since 2018...",className:"min-h-[100px]",value:M,onChange:Qe=>{I(Qe.target.value),q("")}}),j&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:j})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs(Label$2,{children:["Sales Channel(s) ",jsxRuntime.jsx("span",{className:"text-sm text-muted-foreground",children:"(Multi-Select where you currently sell your products)"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:salesChannels.map(Qe=>jsxRuntime.jsxs("div",{className:"flex items-start space-x-2",children:[jsxRuntime.jsx(Checkbox,{id:`channel-${Qe.id}`,checked:z.includes(Qe.id),onCheckedChange:Xe=>He(Qe.id,Xe===!0)}),jsxRuntime.jsx(Label$2,{htmlFor:`channel-${Qe.id}`,className:"text-sm font-normal",children:Qe.label})]},Qe.id))}),tt&&jsxRuntime.jsx(Input,{placeholder:"Please specify",value:te,onChange:Qe=>ne(Qe.target.value)}),F&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:F})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs(Label$2,{children:["Your Primary Market(s) ",jsxRuntime.jsx("span",{className:"text-sm text-muted-foreground",children:"(Multi-Select which regions you sell to)"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:markets.map(Qe=>jsxRuntime.jsxs("div",{className:"flex items-start space-x-2",children:[jsxRuntime.jsx(Checkbox,{id:`market-${Qe.id}`,checked:se.includes(Qe.id),onCheckedChange:Xe=>Ze(Qe.id,Xe===!0)}),jsxRuntime.jsx(Label$2,{htmlFor:`market-${Qe.id}`,className:"text-sm font-normal",children:Qe.label})]},Qe.id))}),Ye&&jsxRuntime.jsx(Input,{placeholder:"Please specify",value:je,onChange:Qe=>Ne(Qe.target.value)}),oe&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:oe})]}),jsxRuntime.jsx(DialogFooter,{children:jsxRuntime.jsx(Button,{type:"submit",disabled:E,children:E?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Submitting..."]}):"Submit"})})]})]})})]})}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$1=createPopperScope(),[SelectProvider,useSelectContext]=createSelectContext(SELECT_NAME),[SelectNativeOptionsProvider,useSelectNativeOptionsContext]=createSelectContext(SELECT_NAME),Select$1=t=>{const{__scopeSelect:e,children:n,open:o,defaultOpen:l,onOpenChange:d,value:f,defaultValue:g,onValueChange:b,dir:_,name:S,autoComplete:R,disabled:C,required:E,form:A}=t,M=usePopperScope$1(e),[I,j]=React__namespace.useState(null),[q,z]=React__namespace.useState(null),[Q,F]=React__namespace.useState(!1),V=useDirection(_),[te,ne]=useControllableState({prop:o,defaultProp:l??!1,onChange:d,caller:SELECT_NAME}),[se,ge]=useControllableState({prop:f,defaultProp:g,onChange:b,caller:SELECT_NAME}),oe=React__namespace.useRef(null),Ae=I?A||!!I.closest("form"):!0,[je,Ne]=React__namespace.useState(new Set),Oe=Array.from(je).map(Fe=>Fe.props.value).join(";");return jsxRuntime.jsx(Root2$6,{...M,children:jsxRuntime.jsxs(SelectProvider,{required:E,scope:e,trigger:I,onTriggerChange:j,valueNode:q,onValueNodeChange:z,valueNodeHasChildren:Q,onValueNodeHasChildrenChange:F,contentId:useId(),value:se,onValueChange:ge,open:te,onOpenChange:ne,dir:V,triggerPointerDownPosRef:oe,disabled:C,children:[jsxRuntime.jsx(Collection.Provider,{scope:e,children:jsxRuntime.jsx(SelectNativeOptionsProvider,{scope:t.__scopeSelect,onNativeOptionAdd:React__namespace.useCallback(Fe=>{Ne(ze=>new Set(ze).add(Fe))},[]),onNativeOptionRemove:React__namespace.useCallback(Fe=>{Ne(ze=>{const $e=new Set(ze);return $e.delete(Fe),$e})},[]),children:n})}),Ae?jsxRuntime.jsxs(SelectBubbleInput,{"aria-hidden":!0,required:E,tabIndex:-1,name:S,autoComplete:R,value:se,onChange:Fe=>ge(Fe.target.value),disabled:C,form:A,children:[se===void 0?jsxRuntime.jsx("option",{value:""}):null,Array.from(je)]},Oe):null]})})};Select$1.displayName=SELECT_NAME;var TRIGGER_NAME$2="SelectTrigger",SelectTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:o=!1,...l}=t,d=usePopperScope$1(n),f=useSelectContext(TRIGGER_NAME$2,n),g=f.disabled||o,b=useComposedRefs(e,f.onTriggerChange),_=useCollection(n),S=React__namespace.useRef("touch"),[R,C,E]=useTypeaheadSearch(M=>{const I=_().filter(z=>!z.disabled),j=I.find(z=>z.value===f.value),q=findNextItem(I,M,j);q!==void 0&&f.onValueChange(q.value)}),A=M=>{g||(f.onOpenChange(!0),E()),M&&(f.triggerPointerDownPosRef.current={x:Math.round(M.pageX),y:Math.round(M.pageY)})};return jsxRuntime.jsx(Anchor,{asChild:!0,...d,children:jsxRuntime.jsx(Primitive.button,{type:"button",role:"combobox","aria-controls":f.contentId,"aria-expanded":f.open,"aria-required":f.required,"aria-autocomplete":"none",dir:f.dir,"data-state":f.open?"open":"closed",disabled:g,"data-disabled":g?"":void 0,"data-placeholder":shouldShowPlaceholder(f.value)?"":void 0,...l,ref:b,onClick:composeEventHandlers(l.onClick,M=>{M.currentTarget.focus(),S.current!=="mouse"&&A(M)}),onPointerDown:composeEventHandlers(l.onPointerDown,M=>{S.current=M.pointerType;const I=M.target;I.hasPointerCapture(M.pointerId)&&I.releasePointerCapture(M.pointerId),M.button===0&&M.ctrlKey===!1&&M.pointerType==="mouse"&&(A(M),M.preventDefault())}),onKeyDown:composeEventHandlers(l.onKeyDown,M=>{const I=R.current!=="";!(M.ctrlKey||M.altKey||M.metaKey)&&M.key.length===1&&C(M.key),!(I&&M.key===" ")&&OPEN_KEYS.includes(M.key)&&(A(),M.preventDefault())})})})});SelectTrigger$1.displayName=TRIGGER_NAME$2;var VALUE_NAME="SelectValue",SelectValue$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,className:o,style:l,children:d,placeholder:f="",...g}=t,b=useSelectContext(VALUE_NAME,n),{onValueNodeHasChildrenChange:_}=b,S=d!==void 0,R=useComposedRefs(e,b.onValueNodeChange);return useLayoutEffect2(()=>{_(S)},[_,S]),jsxRuntime.jsx(Primitive.span,{...g,ref:R,style:{pointerEvents:"none"},children:shouldShowPlaceholder(b.value)?jsxRuntime.jsx(jsxRuntime.Fragment,{children:f}):d})});SelectValue$1.displayName=VALUE_NAME;var ICON_NAME="SelectIcon",SelectIcon=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,children:o,...l}=t;return jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...l,ref:e,children:o||"▼"})});SelectIcon.displayName=ICON_NAME;var PORTAL_NAME$2="SelectPortal",SelectPortal=t=>jsxRuntime.jsx(Portal$5,{asChild:!0,...t});SelectPortal.displayName=PORTAL_NAME$2;var CONTENT_NAME$2="SelectContent",SelectContent$1=React__namespace.forwardRef((t,e)=>{const n=useSelectContext(CONTENT_NAME$2,t.__scopeSelect),[o,l]=React__namespace.useState();if(useLayoutEffect2(()=>{l(new DocumentFragment)},[]),!n.open){const d=o;return d?ReactDOM__namespace.createPortal(jsxRuntime.jsx(SelectContentProvider,{scope:t.__scopeSelect,children:jsxRuntime.jsx(Collection.Slot,{scope:t.__scopeSelect,children:jsxRuntime.jsx("div",{children:t.children})})}),d):null}return jsxRuntime.jsx(SelectContentImpl,{...t,ref:e})});SelectContent$1.displayName=CONTENT_NAME$2;var CONTENT_MARGIN=10,[SelectContentProvider,useSelectContentContext]=createSelectContext(CONTENT_NAME$2),CONTENT_IMPL_NAME="SelectContentImpl",Slot$1=createSlot("SelectContent.RemoveScroll"),SelectContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:d,onPointerDownOutside:f,side:g,sideOffset:b,align:_,alignOffset:S,arrowPadding:R,collisionBoundary:C,collisionPadding:E,sticky:A,hideWhenDetached:M,avoidCollisions:I,...j}=t,q=useSelectContext(CONTENT_NAME$2,n),[z,Q]=React__namespace.useState(null),[F,V]=React__namespace.useState(null),te=useComposedRefs(e,Xe=>Q(Xe)),[ne,se]=React__namespace.useState(null),[ge,oe]=React__namespace.useState(null),Ae=useCollection(n),[je,Ne]=React__namespace.useState(!1),Oe=React__namespace.useRef(!1);React__namespace.useEffect(()=>{if(z)return hideOthers(z)},[z]),useFocusGuards();const Fe=React__namespace.useCallback(Xe=>{const[st,...rt]=Ae().map(Ue=>Ue.ref.current),[at]=rt.slice(-1),ot=document.activeElement;for(const Ue of Xe)if(Ue===ot||(Ue==null||Ue.scrollIntoView({block:"nearest"}),Ue===st&&F&&(F.scrollTop=0),Ue===at&&F&&(F.scrollTop=F.scrollHeight),Ue==null||Ue.focus(),document.activeElement!==ot))return},[Ae,F]),ze=React__namespace.useCallback(()=>Fe([ne,z]),[Fe,ne,z]);React__namespace.useEffect(()=>{je&&ze()},[je,ze]);const{onOpenChange:$e,triggerPointerDownPosRef:Be}=q;React__namespace.useEffect(()=>{if(z){let Xe={x:0,y:0};const st=at=>{var ot,Ue;Xe={x:Math.abs(Math.round(at.pageX)-(((ot=Be.current)==null?void 0:ot.x)??0)),y:Math.abs(Math.round(at.pageY)-(((Ue=Be.current)==null?void 0:Ue.y)??0))}},rt=at=>{Xe.x<=10&&Xe.y<=10?at.preventDefault():z.contains(at.target)||$e(!1),document.removeEventListener("pointermove",st),Be.current=null};return Be.current!==null&&(document.addEventListener("pointermove",st),document.addEventListener("pointerup",rt,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",st),document.removeEventListener("pointerup",rt,{capture:!0})}}},[z,$e,Be]),React__namespace.useEffect(()=>{const Xe=()=>$e(!1);return window.addEventListener("blur",Xe),window.addEventListener("resize",Xe),()=>{window.removeEventListener("blur",Xe),window.removeEventListener("resize",Xe)}},[$e]);const[qe,Ge]=useTypeaheadSearch(Xe=>{const st=Ae().filter(ot=>!ot.disabled),rt=st.find(ot=>ot.ref.current===document.activeElement),at=findNextItem(st,Xe,rt);at&&setTimeout(()=>at.ref.current.focus())}),He=React__namespace.useCallback((Xe,st,rt)=>{const at=!Oe.current&&!rt;(q.value!==void 0&&q.value===st||at)&&(se(Xe),at&&(Oe.current=!0))},[q.value]),Ze=React__namespace.useCallback(()=>z==null?void 0:z.focus(),[z]),tt=React__namespace.useCallback((Xe,st,rt)=>{const at=!Oe.current&&!rt;(q.value!==void 0&&q.value===st||at)&&oe(Xe)},[q.value]),Ye=o==="popper"?SelectPopperPosition:SelectItemAlignedPosition,Qe=Ye===SelectPopperPosition?{side:g,sideOffset:b,align:_,alignOffset:S,arrowPadding:R,collisionBoundary:C,collisionPadding:E,sticky:A,hideWhenDetached:M,avoidCollisions:I}:{};return jsxRuntime.jsx(SelectContentProvider,{scope:n,content:z,viewport:F,onViewportChange:V,itemRefCallback:He,selectedItem:ne,onItemLeave:Ze,itemTextRefCallback:tt,focusSelectedItem:ze,selectedItemText:ge,position:o,isPositioned:je,searchRef:qe,children:jsxRuntime.jsx(ReactRemoveScroll,{as:Slot$1,allowPinchZoom:!0,children:jsxRuntime.jsx(FocusScope,{asChild:!0,trapped:q.open,onMountAutoFocus:Xe=>{Xe.preventDefault()},onUnmountAutoFocus:composeEventHandlers(l,Xe=>{var st;(st=q.trigger)==null||st.focus({preventScroll:!0}),Xe.preventDefault()}),children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:Xe=>Xe.preventDefault(),onDismiss:()=>q.onOpenChange(!1),children:jsxRuntime.jsx(Ye,{role:"listbox",id:q.contentId,"data-state":q.open?"open":"closed",dir:q.dir,onContextMenu:Xe=>Xe.preventDefault(),...j,...Qe,onPlaced:()=>Ne(!0),ref:te,style:{display:"flex",flexDirection:"column",outline:"none",...j.style},onKeyDown:composeEventHandlers(j.onKeyDown,Xe=>{const st=Xe.ctrlKey||Xe.altKey||Xe.metaKey;if(Xe.key==="Tab"&&Xe.preventDefault(),!st&&Xe.key.length===1&&Ge(Xe.key),["ArrowUp","ArrowDown","Home","End"].includes(Xe.key)){let at=Ae().filter(ot=>!ot.disabled).map(ot=>ot.ref.current);if(["ArrowUp","End"].includes(Xe.key)&&(at=at.slice().reverse()),["ArrowUp","ArrowDown"].includes(Xe.key)){const ot=Xe.target,Ue=at.indexOf(ot);at=at.slice(Ue+1)}setTimeout(()=>Fe(at)),Xe.preventDefault()}})})})})})})});SelectContentImpl.displayName=CONTENT_IMPL_NAME;var ITEM_ALIGNED_POSITION_NAME="SelectItemAlignedPosition",SelectItemAlignedPosition=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:o,...l}=t,d=useSelectContext(CONTENT_NAME$2,n),f=useSelectContentContext(CONTENT_NAME$2,n),[g,b]=React__namespace.useState(null),[_,S]=React__namespace.useState(null),R=useComposedRefs(e,te=>S(te)),C=useCollection(n),E=React__namespace.useRef(!1),A=React__namespace.useRef(!0),{viewport:M,selectedItem:I,selectedItemText:j,focusSelectedItem:q}=f,z=React__namespace.useCallback(()=>{if(d.trigger&&d.valueNode&&g&&_&&M&&I&&j){const te=d.trigger.getBoundingClientRect(),ne=_.getBoundingClientRect(),se=d.valueNode.getBoundingClientRect(),ge=j.getBoundingClientRect();if(d.dir!=="rtl"){const ot=ge.left-ne.left,Ue=se.left-ot,Ct=te.left-Ue,Je=te.width+Ct,yt=Math.max(Je,ne.width),Mt=window.innerWidth-CONTENT_MARGIN,qt=clamp(Ue,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,Mt-yt)]);g.style.minWidth=Je+"px",g.style.left=qt+"px"}else{const ot=ne.right-ge.right,Ue=window.innerWidth-se.right-ot,Ct=window.innerWidth-te.right-Ue,Je=te.width+Ct,yt=Math.max(Je,ne.width),Mt=window.innerWidth-CONTENT_MARGIN,qt=clamp(Ue,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,Mt-yt)]);g.style.minWidth=Je+"px",g.style.right=qt+"px"}const oe=C(),Ae=window.innerHeight-CONTENT_MARGIN*2,je=M.scrollHeight,Ne=window.getComputedStyle(_),Oe=parseInt(Ne.borderTopWidth,10),Fe=parseInt(Ne.paddingTop,10),ze=parseInt(Ne.borderBottomWidth,10),$e=parseInt(Ne.paddingBottom,10),Be=Oe+Fe+je+$e+ze,qe=Math.min(I.offsetHeight*5,Be),Ge=window.getComputedStyle(M),He=parseInt(Ge.paddingTop,10),Ze=parseInt(Ge.paddingBottom,10),tt=te.top+te.height/2-CONTENT_MARGIN,Ye=Ae-tt,Qe=I.offsetHeight/2,Xe=I.offsetTop+Qe,st=Oe+Fe+Xe,rt=Be-st;if(st<=tt){const ot=oe.length>0&&I===oe[oe.length-1].ref.current;g.style.bottom="0px";const Ue=_.clientHeight-M.offsetTop-M.offsetHeight,Ct=Math.max(Ye,Qe+(ot?Ze:0)+Ue+ze),Je=st+Ct;g.style.height=Je+"px"}else{const ot=oe.length>0&&I===oe[0].ref.current;g.style.top="0px";const Ct=Math.max(tt,Oe+M.offsetTop+(ot?He:0)+Qe)+rt;g.style.height=Ct+"px",M.scrollTop=st-tt+M.offsetTop}g.style.margin=`${CONTENT_MARGIN}px 0`,g.style.minHeight=qe+"px",g.style.maxHeight=Ae+"px",o==null||o(),requestAnimationFrame(()=>E.current=!0)}},[C,d.trigger,d.valueNode,g,_,M,I,j,d.dir,o]);useLayoutEffect2(()=>z(),[z]);const[Q,F]=React__namespace.useState();useLayoutEffect2(()=>{_&&F(window.getComputedStyle(_).zIndex)},[_]);const V=React__namespace.useCallback(te=>{te&&A.current===!0&&(z(),q==null||q(),A.current=!1)},[z,q]);return jsxRuntime.jsx(SelectViewportProvider,{scope:n,contentWrapper:g,shouldExpandOnScrollRef:E,onScrollButtonChange:V,children:jsxRuntime.jsx("div",{ref:b,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:Q},children:jsxRuntime.jsx(Primitive.div,{...l,ref:R,style:{boxSizing:"border-box",maxHeight:"100%",...l.style}})})})});SelectItemAlignedPosition.displayName=ITEM_ALIGNED_POSITION_NAME;var POPPER_POSITION_NAME="SelectPopperPosition",SelectPopperPosition=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,align:o="start",collisionPadding:l=CONTENT_MARGIN,...d}=t,f=usePopperScope$1(n);return jsxRuntime.jsx(Content$1,{...f,...d,ref:e,align:o,collisionPadding:l,style:{boxSizing:"border-box",...d.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$2,{}),VIEWPORT_NAME="SelectViewport",SelectViewport=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:o,...l}=t,d=useSelectContentContext(VIEWPORT_NAME,n),f=useSelectViewportContext(VIEWPORT_NAME,n),g=useComposedRefs(e,d.onViewportChange),b=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:o}),jsxRuntime.jsx(Collection.Slot,{scope:n,children:jsxRuntime.jsx(Primitive.div,{"data-radix-select-viewport":"",role:"presentation",...l,ref:g,style:{position:"relative",flex:1,overflow:"hidden auto",...l.style},onScroll:composeEventHandlers(l.onScroll,_=>{const S=_.currentTarget,{contentWrapper:R,shouldExpandOnScrollRef:C}=f;if(C!=null&&C.current&&R){const E=Math.abs(b.current-S.scrollTop);if(E>0){const A=window.innerHeight-CONTENT_MARGIN*2,M=parseFloat(R.style.minHeight),I=parseFloat(R.style.height),j=Math.max(M,I);if(j<A){const q=j+E,z=Math.min(A,q),Q=q-z;R.style.height=z+"px",R.style.bottom==="0px"&&(S.scrollTop=Q>0?Q:0,R.style.justifyContent="flex-end")}}}b.current=S.scrollTop})})})]})});SelectViewport.displayName=VIEWPORT_NAME;var GROUP_NAME="SelectGroup",[SelectGroupContextProvider,useSelectGroupContext]=createSelectContext(GROUP_NAME),SelectGroup$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t,l=useId();return jsxRuntime.jsx(SelectGroupContextProvider,{scope:n,id:l,children:jsxRuntime.jsx(Primitive.div,{role:"group","aria-labelledby":l,...o,ref:e})})});SelectGroup$1.displayName=GROUP_NAME;var LABEL_NAME="SelectLabel",SelectLabel$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t,l=useSelectGroupContext(LABEL_NAME,n);return jsxRuntime.jsx(Primitive.div,{id:l.id,...o,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:o,disabled:l=!1,textValue:d,...f}=t,g=useSelectContext(ITEM_NAME,n),b=useSelectContentContext(ITEM_NAME,n),_=g.value===o,[S,R]=React__namespace.useState(d??""),[C,E]=React__namespace.useState(!1),A=useComposedRefs(e,q=>{var z;return(z=b.itemRefCallback)==null?void 0:z.call(b,q,o,l)}),M=useId(),I=React__namespace.useRef("touch"),j=()=>{l||(g.onValueChange(o),g.onOpenChange(!1))};if(o==="")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:o,disabled:l,textId:M,isSelected:_,onItemTextChange:React__namespace.useCallback(q=>{R(z=>z||((q==null?void 0:q.textContent)??"").trim())},[]),children:jsxRuntime.jsx(Collection.ItemSlot,{scope:n,value:o,disabled:l,textValue:S,children:jsxRuntime.jsx(Primitive.div,{role:"option","aria-labelledby":M,"data-highlighted":C?"":void 0,"aria-selected":_&&C,"data-state":_?"checked":"unchecked","aria-disabled":l||void 0,"data-disabled":l?"":void 0,tabIndex:l?void 0:-1,...f,ref:A,onFocus:composeEventHandlers(f.onFocus,()=>E(!0)),onBlur:composeEventHandlers(f.onBlur,()=>E(!1)),onClick:composeEventHandlers(f.onClick,()=>{I.current!=="mouse"&&j()}),onPointerUp:composeEventHandlers(f.onPointerUp,()=>{I.current==="mouse"&&j()}),onPointerDown:composeEventHandlers(f.onPointerDown,q=>{I.current=q.pointerType}),onPointerMove:composeEventHandlers(f.onPointerMove,q=>{var z;I.current=q.pointerType,l?(z=b.onItemLeave)==null||z.call(b):I.current==="mouse"&&q.currentTarget.focus({preventScroll:!0})}),onPointerLeave:composeEventHandlers(f.onPointerLeave,q=>{var z;q.currentTarget===document.activeElement&&((z=b.onItemLeave)==null||z.call(b))}),onKeyDown:composeEventHandlers(f.onKeyDown,q=>{var Q;((Q=b.searchRef)==null?void 0:Q.current)!==""&&q.key===" "||(SELECTION_KEYS.includes(q.key)&&j(),q.key===" "&&q.preventDefault())})})})})});SelectItem$1.displayName=ITEM_NAME;var ITEM_TEXT_NAME="SelectItemText",SelectItemText=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,className:o,style:l,...d}=t,f=useSelectContext(ITEM_TEXT_NAME,n),g=useSelectContentContext(ITEM_TEXT_NAME,n),b=useSelectItemContext(ITEM_TEXT_NAME,n),_=useSelectNativeOptionsContext(ITEM_TEXT_NAME,n),[S,R]=React__namespace.useState(null),C=useComposedRefs(e,j=>R(j),b.onItemTextChange,j=>{var q;return(q=g.itemTextRefCallback)==null?void 0:q.call(g,j,b.value,b.disabled)}),E=S==null?void 0:S.textContent,A=React__namespace.useMemo(()=>jsxRuntime.jsx("option",{value:b.value,disabled:b.disabled,children:E},b.value),[b.disabled,b.value,E]),{onNativeOptionAdd:M,onNativeOptionRemove:I}=_;return useLayoutEffect2(()=>(M(A),()=>I(A)),[M,I,A]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Primitive.span,{id:b.textId,...d,ref:C}),b.isSelected&&f.valueNode&&!f.valueNodeHasChildren?ReactDOM__namespace.createPortal(d.children,f.valueNode):null]})});SelectItemText.displayName=ITEM_TEXT_NAME;var ITEM_INDICATOR_NAME="SelectItemIndicator",SelectItemIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t;return useSelectItemContext(ITEM_INDICATOR_NAME,n).isSelected?jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...o,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),o=useSelectViewportContext(SCROLL_UP_BUTTON_NAME,t.__scopeSelect),[l,d]=React__namespace.useState(!1),f=useComposedRefs(e,o.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let g=function(){const _=b.scrollTop>0;d(_)};const b=n.viewport;return g(),b.addEventListener("scroll",g),()=>b.removeEventListener("scroll",g)}},[n.viewport,n.isPositioned]),l?jsxRuntime.jsx(SelectScrollButtonImpl,{...t,ref:f,onAutoScroll:()=>{const{viewport:g,selectedItem:b}=n;g&&b&&(g.scrollTop=g.scrollTop-b.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),o=useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME,t.__scopeSelect),[l,d]=React__namespace.useState(!1),f=useComposedRefs(e,o.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let g=function(){const _=b.scrollHeight-b.clientHeight,S=Math.ceil(b.scrollTop)<_;d(S)};const b=n.viewport;return g(),b.addEventListener("scroll",g),()=>b.removeEventListener("scroll",g)}},[n.viewport,n.isPositioned]),l?jsxRuntime.jsx(SelectScrollButtonImpl,{...t,ref:f,onAutoScroll:()=>{const{viewport:g,selectedItem:b}=n;g&&b&&(g.scrollTop=g.scrollTop+b.offsetHeight)}}):null});SelectScrollDownButton$1.displayName=SCROLL_DOWN_BUTTON_NAME;var SelectScrollButtonImpl=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:o,...l}=t,d=useSelectContentContext("SelectScrollButton",n),f=React__namespace.useRef(null),g=useCollection(n),b=React__namespace.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return React__namespace.useEffect(()=>()=>b(),[b]),useLayoutEffect2(()=>{var S;const _=g().find(R=>R.ref.current===document.activeElement);(S=_==null?void 0:_.ref.current)==null||S.scrollIntoView({block:"nearest"})},[g]),jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...l,ref:e,style:{flexShrink:0,...l.style},onPointerDown:composeEventHandlers(l.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(o,50))}),onPointerMove:composeEventHandlers(l.onPointerMove,()=>{var _;(_=d.onItemLeave)==null||_.call(d),f.current===null&&(f.current=window.setInterval(o,50))}),onPointerLeave:composeEventHandlers(l.onPointerLeave,()=>{b()})})}),SEPARATOR_NAME="SelectSeparator",SelectSeparator$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t;return jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...o,ref:e})});SelectSeparator$1.displayName=SEPARATOR_NAME;var ARROW_NAME$1="SelectArrow",SelectArrow=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t,l=usePopperScope$1(n),d=useSelectContext(ARROW_NAME$1,n),f=useSelectContentContext(ARROW_NAME$1,n);return d.open&&f.position==="popper"?jsxRuntime.jsx(Arrow,{...l,...o,ref:e}):null});SelectArrow.displayName=ARROW_NAME$1;var BUBBLE_INPUT_NAME="SelectBubbleInput",SelectBubbleInput=React__namespace.forwardRef(({__scopeSelect:t,value:e,...n},o)=>{const l=React__namespace.useRef(null),d=useComposedRefs(o,l),f=usePrevious(e);return React__namespace.useEffect(()=>{const g=l.current;if(!g)return;const b=window.HTMLSelectElement.prototype,S=Object.getOwnPropertyDescriptor(b,"value").set;if(f!==e&&S){const R=new Event("change",{bubbles:!0});S.call(g,e),g.dispatchEvent(R)}},[f,e]),jsxRuntime.jsx(Primitive.select,{...n,style:{...VISUALLY_HIDDEN_STYLES,...n.style},ref:d,defaultValue:e})});SelectBubbleInput.displayName=BUBBLE_INPUT_NAME;function shouldShowPlaceholder(t){return t===""||t===void 0}function useTypeaheadSearch(t){const e=useCallbackRef$1(t),n=React__namespace.useRef(""),o=React__namespace.useRef(0),l=React__namespace.useCallback(f=>{const g=n.current+f;e(g),function b(_){n.current=_,window.clearTimeout(o.current),_!==""&&(o.current=window.setTimeout(()=>b(""),1e3))}(g)},[e]),d=React__namespace.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return React__namespace.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,l,d]}function findNextItem(t,e,n){const l=e.length>1&&Array.from(e).every(_=>_===e[0])?e[0]:e,d=n?t.indexOf(n):-1;let f=wrapArray(t,Math.max(d,0));l.length===1&&(f=f.filter(_=>_!==n));const b=f.find(_=>_.textValue.toLowerCase().startsWith(l.toLowerCase()));return b!==n?b:void 0}function wrapArray(t,e){return t.map((n,o)=>t[(e+o)%t.length])}var Root2$2=Select$1,Trigger$1=SelectTrigger$1,Value=SelectValue$1,Icon=SelectIcon,Portal$1=SelectPortal,Content2$2=SelectContent$1,Viewport=SelectViewport,Group=SelectGroup$1,Label=SelectLabel$1,Item$1=SelectItem$1,ItemText=SelectItemText,ItemIndicator=SelectItemIndicator,ScrollUpButton=SelectScrollUpButton$1,ScrollDownButton=SelectScrollDownButton$1,Separator=SelectSeparator$1;const Select=Root2$2,SelectGroup=Group,SelectValue=Value,SelectTrigger=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsxs(Trigger$1,{ref:o,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$1.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",...o},l)=>jsxRuntime.jsx(Portal$1,{children:jsxRuntime.jsxs(Content2$2,{ref:l,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,...o,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$2.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},o)=>jsxRuntime.jsxs(Item$1,{ref:o,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$1.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;const DAYS_OF_WEEK=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function ManufacturerReorderingCard({manufacturer:t,onSave:e,loading:n=!1,saving:o=!1,readonly:l=!1}){const[d,f]=React.useState({...t}),[g,b]=React.useState({...t});React.useEffect(()=>{b({...t}),f({...t})},[t]);const _=(j,q)=>{l||f(z=>({...z,[j]:q}))},S=(j,q)=>{l||f(z=>({...z,[j]:q}))},R=(j,q)=>{l||f(z=>({...z,[j]:q}))},C=()=>{const j={};return Object.keys(d).forEach(q=>{const z=q;JSON.stringify(d[z])!==JSON.stringify(g[z])&&(j[z]=d[z])}),j},E=()=>{if(!o&&!l){const j=C();Object.keys(j).length>0&&e(j)}},A=j=>j===-1?"ASAP":j===void 0||j<0||j>6?"Sunday":DAYS_OF_WEEK[j],M=j=>j==="ASAP"?-1:DAYS_OF_WEEK.indexOf(j),I=Object.keys(C()).length>0;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:d.AutoUpdate,onCheckedChange:j=>_("AutoUpdate",j),disabled:o||l}),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:A(d.AutoReorderDate),onValueChange:j=>S("AutoReorderDate",M(j)),disabled:o||l,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(j=>jsxRuntime.jsx(SelectItem,{value:j,children:j},j))]})]})]}),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:d.DefaultWeeksOfStocking||"",onChange:j=>S("DefaultWeeksOfStocking",Number(j.target.value)),disabled:o||l}),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:d.DefaultMinimumOrder||"",onChange:j=>S("DefaultMinimumOrder",Number(j.target.value)),disabled:o||l})]})]}),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:d.DefaultLeadTime||"",onChange:j=>S("DefaultLeadTime",Number(j.target.value)),disabled:o||l}),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:d.DefaultMaxInventoryValue||"",onChange:j=>S("DefaultMaxInventoryValue",Number(j.target.value)),disabled:o||l})]})]}),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:d.POEmail||"",onChange:j=>R("POEmail",j.target.value),placeholder:"email@example.com",disabled:o||l})]})]})]})}),!l&&jsxRuntime.jsx(CardFooter,{className:"flex justify-end",children:n?jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"}):jsxRuntime.jsxs(Button,{onClick:E,disabled:o||!I,children:[o&&jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Save"]})})]})}var POPOVER_NAME="Popover",[createPopoverContext,createPopoverScope]=createContextScope(POPOVER_NAME,[createPopperScope]),usePopperScope=createPopperScope(),[PopoverProvider,usePopoverContext]=createPopoverContext(POPOVER_NAME),Popover$1=t=>{const{__scopePopover:e,children:n,open:o,defaultOpen:l,onOpenChange:d,modal:f=!1}=t,g=usePopperScope(e),b=React__namespace.useRef(null),[_,S]=React__namespace.useState(!1),[R,C]=useControllableState({prop:o,defaultProp:l??!1,onChange:d,caller:POPOVER_NAME});return jsxRuntime.jsx(Root2$6,{...g,children:jsxRuntime.jsx(PopoverProvider,{scope:e,contentId:useId(),triggerRef:b,open:R,onOpenChange:C,onOpenToggle:React__namespace.useCallback(()=>C(E=>!E),[C]),hasCustomAnchor:_,onCustomAnchorAdd:React__namespace.useCallback(()=>S(!0),[]),onCustomAnchorRemove:React__namespace.useCallback(()=>S(!1),[]),modal:f,children:n})})};Popover$1.displayName=POPOVER_NAME;var ANCHOR_NAME="PopoverAnchor",PopoverAnchor$1=React__namespace.forwardRef((t,e)=>{const{__scopePopover:n,...o}=t,l=usePopoverContext(ANCHOR_NAME,n),d=usePopperScope(n),{onCustomAnchorAdd:f,onCustomAnchorRemove:g}=l;return React__namespace.useEffect(()=>(f(),()=>g()),[f,g]),jsxRuntime.jsx(Anchor,{...d,...o,ref:e})});PopoverAnchor$1.displayName=ANCHOR_NAME;var TRIGGER_NAME$1="PopoverTrigger",PopoverTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopePopover:n,...o}=t,l=usePopoverContext(TRIGGER_NAME$1,n),d=usePopperScope(n),f=useComposedRefs(e,l.triggerRef),g=jsxRuntime.jsx(Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":getState(l.open),...o,ref:f,onClick:composeEventHandlers(t.onClick,l.onOpenToggle)});return l.hasCustomAnchor?g:jsxRuntime.jsx(Anchor,{asChild:!0,...d,children:g})});PopoverTrigger$1.displayName=TRIGGER_NAME$1;var PORTAL_NAME$1="PopoverPortal",[PortalProvider,usePortalContext]=createPopoverContext(PORTAL_NAME$1,{forceMount:void 0}),PopoverPortal=t=>{const{__scopePopover:e,forceMount:n,children:o,container:l}=t,d=usePopoverContext(PORTAL_NAME$1,e);return jsxRuntime.jsx(PortalProvider,{scope:e,forceMount:n,children:jsxRuntime.jsx(Presence,{present:n||d.open,children:jsxRuntime.jsx(Portal$5,{asChild:!0,container:l,children:o})})})};PopoverPortal.displayName=PORTAL_NAME$1;var CONTENT_NAME$1="PopoverContent",PopoverContent$1=React__namespace.forwardRef((t,e)=>{const n=usePortalContext(CONTENT_NAME$1,t.__scopePopover),{forceMount:o=n.forceMount,...l}=t,d=usePopoverContext(CONTENT_NAME$1,t.__scopePopover);return jsxRuntime.jsx(Presence,{present:o||d.open,children:d.modal?jsxRuntime.jsx(PopoverContentModal,{...l,ref:e}):jsxRuntime.jsx(PopoverContentNonModal,{...l,ref:e})})});PopoverContent$1.displayName=CONTENT_NAME$1;var Slot=createSlot("PopoverContent.RemoveScroll"),PopoverContentModal=React__namespace.forwardRef((t,e)=>{const n=usePopoverContext(CONTENT_NAME$1,t.__scopePopover),o=React__namespace.useRef(null),l=useComposedRefs(e,o),d=React__namespace.useRef(!1);return React__namespace.useEffect(()=>{const f=o.current;if(f)return hideOthers(f)},[]),jsxRuntime.jsx(ReactRemoveScroll,{as:Slot,allowPinchZoom:!0,children:jsxRuntime.jsx(PopoverContentImpl,{...t,ref:l,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:composeEventHandlers(t.onCloseAutoFocus,f=>{var g;f.preventDefault(),d.current||(g=n.triggerRef.current)==null||g.focus()}),onPointerDownOutside:composeEventHandlers(t.onPointerDownOutside,f=>{const g=f.detail.originalEvent,b=g.button===0&&g.ctrlKey===!0,_=g.button===2||b;d.current=_},{checkForDefaultPrevented:!1}),onFocusOutside:composeEventHandlers(t.onFocusOutside,f=>f.preventDefault(),{checkForDefaultPrevented:!1})})})}),PopoverContentNonModal=React__namespace.forwardRef((t,e)=>{const n=usePopoverContext(CONTENT_NAME$1,t.__scopePopover),o=React__namespace.useRef(!1),l=React__namespace.useRef(!1);return jsxRuntime.jsx(PopoverContentImpl,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:d=>{var f,g;(f=t.onCloseAutoFocus)==null||f.call(t,d),d.defaultPrevented||(o.current||(g=n.triggerRef.current)==null||g.focus(),d.preventDefault()),o.current=!1,l.current=!1},onInteractOutside:d=>{var b,_;(b=t.onInteractOutside)==null||b.call(t,d),d.defaultPrevented||(o.current=!0,d.detail.originalEvent.type==="pointerdown"&&(l.current=!0));const f=d.target;((_=n.triggerRef.current)==null?void 0:_.contains(f))&&d.preventDefault(),d.detail.originalEvent.type==="focusin"&&l.current&&d.preventDefault()}})}),PopoverContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:o,onOpenAutoFocus:l,onCloseAutoFocus:d,disableOutsidePointerEvents:f,onEscapeKeyDown:g,onPointerDownOutside:b,onFocusOutside:_,onInteractOutside:S,...R}=t,C=usePopoverContext(CONTENT_NAME$1,n),E=usePopperScope(n);return useFocusGuards(),jsxRuntime.jsx(FocusScope,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:l,onUnmountAutoFocus:d,children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:f,onInteractOutside:S,onEscapeKeyDown:g,onPointerDownOutside:b,onFocusOutside:_,onDismiss:()=>C.onOpenChange(!1),children:jsxRuntime.jsx(Content$1,{"data-state":getState(C.open),role:"dialog",id:C.contentId,...E,...R,ref:e,style:{...R.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),CLOSE_NAME="PopoverClose",PopoverClose=React__namespace.forwardRef((t,e)=>{const{__scopePopover:n,...o}=t,l=usePopoverContext(CLOSE_NAME,n);return jsxRuntime.jsx(Primitive.button,{type:"button",...o,ref:e,onClick:composeEventHandlers(t.onClick,()=>l.onOpenChange(!1))})});PopoverClose.displayName=CLOSE_NAME;var ARROW_NAME="PopoverArrow",PopoverArrow=React__namespace.forwardRef((t,e)=>{const{__scopePopover:n,...o}=t,l=usePopperScope(n);return jsxRuntime.jsx(Arrow,{...l,...o,ref:e})});PopoverArrow.displayName=ARROW_NAME;function getState(t){return t?"open":"closed"}var Root2$1=Popover$1,Anchor2=PopoverAnchor$1,Trigger=PopoverTrigger$1,Portal=PopoverPortal,Content2$1=PopoverContent$1;const Popover=Root2$1,PopoverTrigger=Trigger,PopoverAnchor=Anchor2,PopoverContent=React__namespace.forwardRef(({className:t,align:e="center",sideOffset:n=4,...o},l)=>jsxRuntime.jsx(Portal,{children:jsxRuntime.jsx(Content2$1,{ref:l,align:e,sideOffset:n,className:cn("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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-popover-content-transform-origin]",t),...o})}));PopoverContent.displayName=Content2$1.displayName;function MultiSelect({options:t,selected:e,onChange:n,placeholder:o="Select items...",disabled:l=!1}){const[d,f]=React__namespace.useState(!1),[g,b]=React__namespace.useState(""),_=React__namespace.useRef(null),[S,R]=React__namespace.useState(void 0),C=React__namespace.useCallback(()=>{_.current&&R(_.current.offsetWidth)},[]);React__namespace.useLayoutEffect(()=>{C()},[C]),React__namespace.useEffect(()=>(window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)),[C]);const E=I=>{n(e.filter(j=>j!==I))},A=I=>{f(!1),e.includes(I)?n(e.filter(j=>j!==I)):n([...e,I])},M=I=>{I.key==="Enter"&&g&&!t.includes(g)&&!e.includes(g)&&(I.preventDefault(),A(g),b(""))};return jsxRuntime.jsxs(Popover,{open:d,onOpenChange:f,children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{ref:_,variant:"outline",role:"combobox","aria-expanded":d,className:"w-full justify-between h-auto min-h-[40px] py-2",disabled:l,children:[jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 items-center",children:e.length>0?e.map(I=>jsxRuntime.jsxs(Badge,{variant:"outline",className:"mr-1 mb-1",children:[I,jsxRuntime.jsx("span",{className:"ml-1 cursor-pointer ring-offset-background rounded-full outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",onClick:j=>{j.preventDefault(),j.stopPropagation(),E(I)},children:jsxRuntime.jsx(X$1,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},I)):jsxRuntime.jsx("span",{className:"text-muted-foreground",children:o})}),jsxRuntime.jsx(ChevronsUpDown,{className:"h-4 w-4 shrink-0 opacity-50 ml-2"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-full p-0",style:{width:S},children:jsxRuntime.jsxs(Command,{onKeyDown:M,children:[jsxRuntime.jsx(CommandInput,{placeholder:"Search or add custom item...",value:g,onValueChange:b}),jsxRuntime.jsxs(CommandList,{children:[jsxRuntime.jsx(CommandEmpty,{children:"No item found."}),jsxRuntime.jsxs(CommandGroup,{children:[t.filter(I=>!e.includes(I)).map(I=>jsxRuntime.jsxs(CommandItem,{onSelect:()=>A(I),children:[jsxRuntime.jsx(Check,{className:cn("mr-2 h-4 w-4",e.includes(I)?"opacity-100":"opacity-0")}),I]},I)),g&&!t.includes(g)&&!e.includes(g)&&jsxRuntime.jsxs(CommandItem,{onSelect:()=>A(g),children:['Add "',g,'"']})]})]})]})})]})}const imgSizeMap={sm:100,md:200,lg:300,xl:400};function ProductImage({randmarSKU:t,size:e="md",alt:n,secondaryContent:o}){const[l,d]=React__namespace.useState(!1),[f,g]=React__namespace.useState(!1),[b,_]=React__namespace.useState(!1),[S,R]=React__namespace.useState(!1),[C,E]=React__namespace.useState(!1),A=`https://api.randmar.io/Product/${t}/Video`,M=React.useRef(null),I=useIntersectionObserver({elementRef:M,threshold:.1,rootMargin:"100px"});React__namespace.useEffect(()=>{const F=async()=>{try{const te=await(await fetch(A+"/Exists")).json();g(te)}catch(V){console.error("Error checking for video:",V),g(!1)}};I&&!b&&(_(!0),F())},[t,A,I,b]);async function j(){if(f){E(!0);try{const V=await(await fetch(A)).blob(),te=window.URL.createObjectURL(V),ne=document.createElement("a");ne.href=te,ne.download=`${t||"product"}-video.mp4`,document.body.appendChild(ne),ne.click(),document.body.removeChild(ne),window.URL.revokeObjectURL(te)}catch(F){console.error("Error downloading video:",F)}finally{E(!1)}}}function q(){navigator.clipboard.writeText(A),R(!0),setTimeout(()=>{R(!1)},2e3)}function z(){d(!0)}const Q=imgSizeMap[e||"xl"];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Dialog,{open:l,onOpenChange:d,children:jsxRuntime.jsx(DialogContent,{className:"max-w-4xl p-0 overflow-hidden",children:o?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:A,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:o})]}):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:A,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:q,children:S?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:j,disabled:C,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",ref:M,children:[jsxRuntime.jsx("img",{alt:n||`Product ${t}`,className:`rounded-md ${f?"cursor-pointer":""}`,onClick:f?z:void 0,src:`https://api.randmar.io/Product/${t}/Image?width=${Q*1.5}&height=${Q*1.5}`,width:Q,height:Q}),f&&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:z,children:jsxRuntime.jsx(Play,{className:"h-4 w-4"})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Play video"})})]})})]})]})}function ResellerBillingOverviewCard({reseller:t,actions:e,loading:n=!1}){return n||!t?jsxRuntime.jsx(ResellerBillingOverviewSkeleton,{}):jsxRuntime.jsx(ResellerBillingOverviewData,{reseller:t,actions:e})}function ResellerBillingOverviewSkeleton(){return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-40"})})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsx("div",{className:"space-y-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:"space-y-4",children:Array(2).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:"flex justify-end mt-4",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-28 rounded-md"})})]})]})}function ResellerBillingOverviewData({reseller:t,actions:e}){const n=t.Statement||{},o=[{title:"0 - 30 Days",amount:n.Over0||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"},{title:"31 - 45 Days",amount:n.Over30||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"},{title:"45+ Days",amount:n.Over45||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"}],l=[{title:"Total",amount:n.Total||0,icon:jsxRuntime.jsx(DollarSign,{className:"h-5 w-5 text-white"}),color:"bg-green-500"},{title:"Credit Limit",amount:t.CreditLimit||0,icon:jsxRuntime.jsx(CreditCard,{className:"h-5 w-5 text-white"}),color:"bg-blue-500"}];return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Billing Overview"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsx("div",{className:"space-y-4",children:o.map((d,f)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("h3",{className:"text-sm sm:text-base font-medium",children:d.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${d.color}`,children:d.icon})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("p",{className:"text-base sm:text-lg font-bold",children:formatMoney(d.amount)})})]},f))}),jsxRuntime.jsx("div",{className:"space-y-4",children:l.map((d,f)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("h3",{className:"text-sm sm:text-base font-medium",children:d.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${d.color}`,children:d.icon})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("p",{className:"text-base sm:text-lg font-bold",children:formatMoney(d.amount)})})]},f))})]}),e&&jsxRuntime.jsx("div",{className:"flex justify-end mt-4",children:e})]})]})}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,o)=>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"})]},o))})})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Qualifications"})}),jsxRuntime.jsx(CardContent,{children:t&&t.length>0?jsxRuntime.jsx("div",{className:"p-6",children:jsxRuntime.jsx("div",{className:"flex 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,o)=>jsxRuntime.jsx(ManufacturerLogo,{manufacturerId:n.ManufacturerId,opportunityNumber:n.DefaultOpportunityNumber},`${n.ManufacturerId}-${o}`))})}):jsxRuntime.jsx("p",{children:"No qualification available."})})]})}function ManufacturerLogo({manufacturerId:t,opportunityNumber:e}){return jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("div",{className:"h-12 w-full items-center justify-center mb-2",children:jsxRuntime.jsx(PartnerLogo,{id:t,width:96,height:48})}),e&&jsxRuntime.jsx(Badge,{variant:"outline",className:"text-xs",children:e})]})}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=[{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"}];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:n.map((o,l)=>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:o.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${o.color}`,children:o.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:formatMoney(o.amount)})]})]},l))}),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(SalesChart,{statistics:e,chartHeight:300,mode:"week"})})]})})]})]})}var ROOT_NAME="AlertDialog",[createAlertDialogContext,createAlertDialogScope]=createContextScope(ROOT_NAME,[createDialogScope]),useDialogScope=createDialogScope(),AlertDialog$1=t=>{const{__scopeAlertDialog:e,...n}=t,o=useDialogScope(e);return jsxRuntime.jsx(Root$8,{...o,...n,modal:!0})};AlertDialog$1.displayName=ROOT_NAME;var TRIGGER_NAME="AlertDialogTrigger",AlertDialogTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...o}=t,l=useDialogScope(n);return jsxRuntime.jsx(Trigger$5,{...l,...o,ref:e})});AlertDialogTrigger$1.displayName=TRIGGER_NAME;var PORTAL_NAME="AlertDialogPortal",AlertDialogPortal$1=t=>{const{__scopeAlertDialog:e,...n}=t,o=useDialogScope(e);return jsxRuntime.jsx(Portal$4,{...o,...n})};AlertDialogPortal$1.displayName=PORTAL_NAME;var OVERLAY_NAME="AlertDialogOverlay",AlertDialogOverlay$1=React__namespace.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...o}=t,l=useDialogScope(n);return jsxRuntime.jsx(Overlay,{...l,...o,ref:e})});AlertDialogOverlay$1.displayName=OVERLAY_NAME;var CONTENT_NAME="AlertDialogContent",[AlertDialogContentProvider,useAlertDialogContentContext]=createAlertDialogContext(CONTENT_NAME),Slottable=createSlottable("AlertDialogContent"),AlertDialogContent$1=React__namespace.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:o,...l}=t,d=useDialogScope(n),f=React__namespace.useRef(null),g=useComposedRefs(e,f),b=React__namespace.useRef(null);return jsxRuntime.jsx(WarningProvider,{contentName:CONTENT_NAME,titleName:TITLE_NAME,docsSlug:"alert-dialog",children:jsxRuntime.jsx(AlertDialogContentProvider,{scope:n,cancelRef:b,children:jsxRuntime.jsxs(Content$2,{role:"alertdialog",...d,...l,ref:g,onOpenAutoFocus:composeEventHandlers(l.onOpenAutoFocus,_=>{var S;_.preventDefault(),(S=b.current)==null||S.focus({preventScroll:!0})}),onPointerDownOutside:_=>_.preventDefault(),onInteractOutside:_=>_.preventDefault(),children:[jsxRuntime.jsx(Slottable,{children:o}),jsxRuntime.jsx(DescriptionWarning,{contentRef:f})]})})})});AlertDialogContent$1.displayName=CONTENT_NAME;var TITLE_NAME="AlertDialogTitle",AlertDialogTitle$1=React__namespace.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...o}=t,l=useDialogScope(n);return jsxRuntime.jsx(Title$1,{...l,...o,ref:e})});AlertDialogTitle$1.displayName=TITLE_NAME;var DESCRIPTION_NAME="AlertDialogDescription",AlertDialogDescription$1=React__namespace.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...o}=t,l=useDialogScope(n);return jsxRuntime.jsx(Description$1,{...l,...o,ref:e})});AlertDialogDescription$1.displayName=DESCRIPTION_NAME;var ACTION_NAME="AlertDialogAction",AlertDialogAction$1=React__namespace.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...o}=t,l=useDialogScope(n);return jsxRuntime.jsx(Close$1,{...l,...o,ref:e})});AlertDialogAction$1.displayName=ACTION_NAME;var CANCEL_NAME="AlertDialogCancel",AlertDialogCancel$1=React__namespace.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...o}=t,{cancelRef:l}=useAlertDialogContentContext(CANCEL_NAME,n),d=useDialogScope(n),f=useComposedRefs(e,l);return jsxRuntime.jsx(Close$1,{...d,...o,ref:f})});AlertDialogCancel$1.displayName=CANCEL_NAME;var DescriptionWarning=({contentRef:t})=>{const e=`\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
1138
+ `);A(!0),Oe({routeApplicationId:t,partnerId:e.ManufacturerId??"",message:at}).then(ot=>{var Ct;if(ot.error){console.error(ot.error),n({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"});return}const Ue=(Ct=ot.data)==null?void 0:Ct.ConversationId;Ue&&Fe(Ue)?(f(!1),$e()):n({title:"Could not send message",description:"Try again later.",variant:"destructive"})}).catch(ot=>{console.error(ot),n({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"})}).finally(()=>{A(!1)})},He=(Qe,Xe)=>{Q(st=>Xe?[...st,Qe]:st.filter(rt=>rt!==Qe)),V("")},Ze=(Qe,Xe)=>{ge(st=>Xe?[...st,Qe]:st.filter(rt=>rt!==Qe)),Ae("")},tt=z.includes("other-channel"),Ye=se.includes("other-market");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!e.Qualification&&jsxRuntime.jsxs(Button,{onClick:Be,disabled:!e.PartnerRegistrationLink&&!e.OpenToWork,children:[jsxRuntime.jsx(Check,{className:"mr-2 h-4 w-4"}),"Get Started"]}),e.PartnerRegistrationLink&&jsxRuntime.jsx(Dialog,{open:o,onOpenChange:Qe=>{l(Qe)},children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[400px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:e.PublicName}),jsxRuntime.jsxs(DialogDescription,{children:[jsxRuntime.jsx("span",{className:"font-bold",children:"Already qualified?"})," Provide your Qualification ID."]})]}),jsxRuntime.jsxs("form",{onSubmit:qe,className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"qualificationId",children:"Qualification ID"}),jsxRuntime.jsx(Input,{id:"qualificationId",placeholder:"Enter your qualification ID",value:_,onChange:Qe=>{S(Qe.target.value),C("")}}),R&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:R})]}),jsxRuntime.jsx(DialogFooter,{children:jsxRuntime.jsx(Button,{type:"submit",className:"w-full",disabled:g,children:g?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Applying..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Check,{className:"mr-2 h-4 w-4"}),"Apply for Qualification"]})})})]}),jsxRuntime.jsx(Separator$1,{className:"my-4"}),jsxRuntime.jsxs("div",{className:"text-center space-y-2",children:[jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Don't have a qualification ID?"}),jsxRuntime.jsx(reactRouterDom.Link,{to:e.PartnerRegistrationLink,target:"_blank",children:jsxRuntime.jsxs(Button,{variant:"outline",className:"w-full",disabled:!e.PartnerRegistrationLink,children:[jsxRuntime.jsx(ExternalLink,{className:"mr-2 h-4 w-4"}),"Register here"]})})]})]})}),jsxRuntime.jsx(Dialog,{open:d,onOpenChange:Qe=>{f(Qe)},children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[768px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsx(DialogTitle,{children:"Introduce Yourself"})}),jsxRuntime.jsxs("form",{onSubmit:Ge,className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs(Label$2,{htmlFor:"businessDescription",children:["Tell Us About Your Business ",jsxRuntime.jsx("span",{className:"text-sm text-muted-foreground",children:"(Briefly describe your business)"})]}),jsxRuntime.jsx(Textarea,{id:"businessDescription",placeholder:"We are an online retailer specializing in office supplies, serving businesses since 2018...",className:"min-h-[100px]",value:M,onChange:Qe=>{I(Qe.target.value),q("")}}),j&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:j})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs(Label$2,{children:["Sales Channel(s) ",jsxRuntime.jsx("span",{className:"text-sm text-muted-foreground",children:"(Multi-Select where you currently sell your products)"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:salesChannels.map(Qe=>jsxRuntime.jsxs("div",{className:"flex items-start space-x-2",children:[jsxRuntime.jsx(Checkbox,{id:`channel-${Qe.id}`,checked:z.includes(Qe.id),onCheckedChange:Xe=>He(Qe.id,Xe===!0)}),jsxRuntime.jsx(Label$2,{htmlFor:`channel-${Qe.id}`,className:"text-sm font-normal",children:Qe.label})]},Qe.id))}),tt&&jsxRuntime.jsx(Input,{placeholder:"Please specify",value:te,onChange:Qe=>ne(Qe.target.value)}),F&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:F})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs(Label$2,{children:["Your Primary Market(s) ",jsxRuntime.jsx("span",{className:"text-sm text-muted-foreground",children:"(Multi-Select which regions you sell to)"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:markets.map(Qe=>jsxRuntime.jsxs("div",{className:"flex items-start space-x-2",children:[jsxRuntime.jsx(Checkbox,{id:`market-${Qe.id}`,checked:se.includes(Qe.id),onCheckedChange:Xe=>Ze(Qe.id,Xe===!0)}),jsxRuntime.jsx(Label$2,{htmlFor:`market-${Qe.id}`,className:"text-sm font-normal",children:Qe.label})]},Qe.id))}),Ye&&jsxRuntime.jsx(Input,{placeholder:"Please specify",value:je,onChange:Qe=>Ne(Qe.target.value)}),oe&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:oe})]}),jsxRuntime.jsx(DialogFooter,{children:jsxRuntime.jsx(Button,{type:"submit",disabled:E,children:E?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Submitting..."]}):"Submit"})})]})]})})]})}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$1=createPopperScope(),[SelectProvider,useSelectContext]=createSelectContext(SELECT_NAME),[SelectNativeOptionsProvider,useSelectNativeOptionsContext]=createSelectContext(SELECT_NAME),Select$1=t=>{const{__scopeSelect:e,children:n,open:o,defaultOpen:l,onOpenChange:d,value:f,defaultValue:g,onValueChange:b,dir:_,name:S,autoComplete:R,disabled:C,required:E,form:A}=t,M=usePopperScope$1(e),[I,j]=React__namespace.useState(null),[q,z]=React__namespace.useState(null),[Q,F]=React__namespace.useState(!1),V=useDirection(_),[te,ne]=useControllableState({prop:o,defaultProp:l??!1,onChange:d,caller:SELECT_NAME}),[se,ge]=useControllableState({prop:f,defaultProp:g,onChange:b,caller:SELECT_NAME}),oe=React__namespace.useRef(null),Ae=I?A||!!I.closest("form"):!0,[je,Ne]=React__namespace.useState(new Set),Oe=Array.from(je).map(Fe=>Fe.props.value).join(";");return jsxRuntime.jsx(Root2$6,{...M,children:jsxRuntime.jsxs(SelectProvider,{required:E,scope:e,trigger:I,onTriggerChange:j,valueNode:q,onValueNodeChange:z,valueNodeHasChildren:Q,onValueNodeHasChildrenChange:F,contentId:useId(),value:se,onValueChange:ge,open:te,onOpenChange:ne,dir:V,triggerPointerDownPosRef:oe,disabled:C,children:[jsxRuntime.jsx(Collection.Provider,{scope:e,children:jsxRuntime.jsx(SelectNativeOptionsProvider,{scope:t.__scopeSelect,onNativeOptionAdd:React__namespace.useCallback(Fe=>{Ne(ze=>new Set(ze).add(Fe))},[]),onNativeOptionRemove:React__namespace.useCallback(Fe=>{Ne(ze=>{const $e=new Set(ze);return $e.delete(Fe),$e})},[]),children:n})}),Ae?jsxRuntime.jsxs(SelectBubbleInput,{"aria-hidden":!0,required:E,tabIndex:-1,name:S,autoComplete:R,value:se,onChange:Fe=>ge(Fe.target.value),disabled:C,form:A,children:[se===void 0?jsxRuntime.jsx("option",{value:""}):null,Array.from(je)]},Oe):null]})})};Select$1.displayName=SELECT_NAME;var TRIGGER_NAME$2="SelectTrigger",SelectTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:o=!1,...l}=t,d=usePopperScope$1(n),f=useSelectContext(TRIGGER_NAME$2,n),g=f.disabled||o,b=useComposedRefs(e,f.onTriggerChange),_=useCollection(n),S=React__namespace.useRef("touch"),[R,C,E]=useTypeaheadSearch(M=>{const I=_().filter(z=>!z.disabled),j=I.find(z=>z.value===f.value),q=findNextItem(I,M,j);q!==void 0&&f.onValueChange(q.value)}),A=M=>{g||(f.onOpenChange(!0),E()),M&&(f.triggerPointerDownPosRef.current={x:Math.round(M.pageX),y:Math.round(M.pageY)})};return jsxRuntime.jsx(Anchor,{asChild:!0,...d,children:jsxRuntime.jsx(Primitive.button,{type:"button",role:"combobox","aria-controls":f.contentId,"aria-expanded":f.open,"aria-required":f.required,"aria-autocomplete":"none",dir:f.dir,"data-state":f.open?"open":"closed",disabled:g,"data-disabled":g?"":void 0,"data-placeholder":shouldShowPlaceholder(f.value)?"":void 0,...l,ref:b,onClick:composeEventHandlers(l.onClick,M=>{M.currentTarget.focus(),S.current!=="mouse"&&A(M)}),onPointerDown:composeEventHandlers(l.onPointerDown,M=>{S.current=M.pointerType;const I=M.target;I.hasPointerCapture(M.pointerId)&&I.releasePointerCapture(M.pointerId),M.button===0&&M.ctrlKey===!1&&M.pointerType==="mouse"&&(A(M),M.preventDefault())}),onKeyDown:composeEventHandlers(l.onKeyDown,M=>{const I=R.current!=="";!(M.ctrlKey||M.altKey||M.metaKey)&&M.key.length===1&&C(M.key),!(I&&M.key===" ")&&OPEN_KEYS.includes(M.key)&&(A(),M.preventDefault())})})})});SelectTrigger$1.displayName=TRIGGER_NAME$2;var VALUE_NAME="SelectValue",SelectValue$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,className:o,style:l,children:d,placeholder:f="",...g}=t,b=useSelectContext(VALUE_NAME,n),{onValueNodeHasChildrenChange:_}=b,S=d!==void 0,R=useComposedRefs(e,b.onValueNodeChange);return useLayoutEffect2(()=>{_(S)},[_,S]),jsxRuntime.jsx(Primitive.span,{...g,ref:R,style:{pointerEvents:"none"},children:shouldShowPlaceholder(b.value)?jsxRuntime.jsx(jsxRuntime.Fragment,{children:f}):d})});SelectValue$1.displayName=VALUE_NAME;var ICON_NAME="SelectIcon",SelectIcon=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,children:o,...l}=t;return jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...l,ref:e,children:o||"▼"})});SelectIcon.displayName=ICON_NAME;var PORTAL_NAME$2="SelectPortal",SelectPortal=t=>jsxRuntime.jsx(Portal$5,{asChild:!0,...t});SelectPortal.displayName=PORTAL_NAME$2;var CONTENT_NAME$2="SelectContent",SelectContent$1=React__namespace.forwardRef((t,e)=>{const n=useSelectContext(CONTENT_NAME$2,t.__scopeSelect),[o,l]=React__namespace.useState();if(useLayoutEffect2(()=>{l(new DocumentFragment)},[]),!n.open){const d=o;return d?ReactDOM__namespace.createPortal(jsxRuntime.jsx(SelectContentProvider,{scope:t.__scopeSelect,children:jsxRuntime.jsx(Collection.Slot,{scope:t.__scopeSelect,children:jsxRuntime.jsx("div",{children:t.children})})}),d):null}return jsxRuntime.jsx(SelectContentImpl,{...t,ref:e})});SelectContent$1.displayName=CONTENT_NAME$2;var CONTENT_MARGIN=10,[SelectContentProvider,useSelectContentContext]=createSelectContext(CONTENT_NAME$2),CONTENT_IMPL_NAME="SelectContentImpl",Slot$1=createSlot("SelectContent.RemoveScroll"),SelectContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:d,onPointerDownOutside:f,side:g,sideOffset:b,align:_,alignOffset:S,arrowPadding:R,collisionBoundary:C,collisionPadding:E,sticky:A,hideWhenDetached:M,avoidCollisions:I,...j}=t,q=useSelectContext(CONTENT_NAME$2,n),[z,Q]=React__namespace.useState(null),[F,V]=React__namespace.useState(null),te=useComposedRefs(e,Xe=>Q(Xe)),[ne,se]=React__namespace.useState(null),[ge,oe]=React__namespace.useState(null),Ae=useCollection(n),[je,Ne]=React__namespace.useState(!1),Oe=React__namespace.useRef(!1);React__namespace.useEffect(()=>{if(z)return hideOthers(z)},[z]),useFocusGuards();const Fe=React__namespace.useCallback(Xe=>{const[st,...rt]=Ae().map(Ue=>Ue.ref.current),[at]=rt.slice(-1),ot=document.activeElement;for(const Ue of Xe)if(Ue===ot||(Ue==null||Ue.scrollIntoView({block:"nearest"}),Ue===st&&F&&(F.scrollTop=0),Ue===at&&F&&(F.scrollTop=F.scrollHeight),Ue==null||Ue.focus(),document.activeElement!==ot))return},[Ae,F]),ze=React__namespace.useCallback(()=>Fe([ne,z]),[Fe,ne,z]);React__namespace.useEffect(()=>{je&&ze()},[je,ze]);const{onOpenChange:$e,triggerPointerDownPosRef:Be}=q;React__namespace.useEffect(()=>{if(z){let Xe={x:0,y:0};const st=at=>{var ot,Ue;Xe={x:Math.abs(Math.round(at.pageX)-(((ot=Be.current)==null?void 0:ot.x)??0)),y:Math.abs(Math.round(at.pageY)-(((Ue=Be.current)==null?void 0:Ue.y)??0))}},rt=at=>{Xe.x<=10&&Xe.y<=10?at.preventDefault():z.contains(at.target)||$e(!1),document.removeEventListener("pointermove",st),Be.current=null};return Be.current!==null&&(document.addEventListener("pointermove",st),document.addEventListener("pointerup",rt,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",st),document.removeEventListener("pointerup",rt,{capture:!0})}}},[z,$e,Be]),React__namespace.useEffect(()=>{const Xe=()=>$e(!1);return window.addEventListener("blur",Xe),window.addEventListener("resize",Xe),()=>{window.removeEventListener("blur",Xe),window.removeEventListener("resize",Xe)}},[$e]);const[qe,Ge]=useTypeaheadSearch(Xe=>{const st=Ae().filter(ot=>!ot.disabled),rt=st.find(ot=>ot.ref.current===document.activeElement),at=findNextItem(st,Xe,rt);at&&setTimeout(()=>at.ref.current.focus())}),He=React__namespace.useCallback((Xe,st,rt)=>{const at=!Oe.current&&!rt;(q.value!==void 0&&q.value===st||at)&&(se(Xe),at&&(Oe.current=!0))},[q.value]),Ze=React__namespace.useCallback(()=>z==null?void 0:z.focus(),[z]),tt=React__namespace.useCallback((Xe,st,rt)=>{const at=!Oe.current&&!rt;(q.value!==void 0&&q.value===st||at)&&oe(Xe)},[q.value]),Ye=o==="popper"?SelectPopperPosition:SelectItemAlignedPosition,Qe=Ye===SelectPopperPosition?{side:g,sideOffset:b,align:_,alignOffset:S,arrowPadding:R,collisionBoundary:C,collisionPadding:E,sticky:A,hideWhenDetached:M,avoidCollisions:I}:{};return jsxRuntime.jsx(SelectContentProvider,{scope:n,content:z,viewport:F,onViewportChange:V,itemRefCallback:He,selectedItem:ne,onItemLeave:Ze,itemTextRefCallback:tt,focusSelectedItem:ze,selectedItemText:ge,position:o,isPositioned:je,searchRef:qe,children:jsxRuntime.jsx(ReactRemoveScroll,{as:Slot$1,allowPinchZoom:!0,children:jsxRuntime.jsx(FocusScope,{asChild:!0,trapped:q.open,onMountAutoFocus:Xe=>{Xe.preventDefault()},onUnmountAutoFocus:composeEventHandlers(l,Xe=>{var st;(st=q.trigger)==null||st.focus({preventScroll:!0}),Xe.preventDefault()}),children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:Xe=>Xe.preventDefault(),onDismiss:()=>q.onOpenChange(!1),children:jsxRuntime.jsx(Ye,{role:"listbox",id:q.contentId,"data-state":q.open?"open":"closed",dir:q.dir,onContextMenu:Xe=>Xe.preventDefault(),...j,...Qe,onPlaced:()=>Ne(!0),ref:te,style:{display:"flex",flexDirection:"column",outline:"none",...j.style},onKeyDown:composeEventHandlers(j.onKeyDown,Xe=>{const st=Xe.ctrlKey||Xe.altKey||Xe.metaKey;if(Xe.key==="Tab"&&Xe.preventDefault(),!st&&Xe.key.length===1&&Ge(Xe.key),["ArrowUp","ArrowDown","Home","End"].includes(Xe.key)){let at=Ae().filter(ot=>!ot.disabled).map(ot=>ot.ref.current);if(["ArrowUp","End"].includes(Xe.key)&&(at=at.slice().reverse()),["ArrowUp","ArrowDown"].includes(Xe.key)){const ot=Xe.target,Ue=at.indexOf(ot);at=at.slice(Ue+1)}setTimeout(()=>Fe(at)),Xe.preventDefault()}})})})})})})});SelectContentImpl.displayName=CONTENT_IMPL_NAME;var ITEM_ALIGNED_POSITION_NAME="SelectItemAlignedPosition",SelectItemAlignedPosition=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:o,...l}=t,d=useSelectContext(CONTENT_NAME$2,n),f=useSelectContentContext(CONTENT_NAME$2,n),[g,b]=React__namespace.useState(null),[_,S]=React__namespace.useState(null),R=useComposedRefs(e,te=>S(te)),C=useCollection(n),E=React__namespace.useRef(!1),A=React__namespace.useRef(!0),{viewport:M,selectedItem:I,selectedItemText:j,focusSelectedItem:q}=f,z=React__namespace.useCallback(()=>{if(d.trigger&&d.valueNode&&g&&_&&M&&I&&j){const te=d.trigger.getBoundingClientRect(),ne=_.getBoundingClientRect(),se=d.valueNode.getBoundingClientRect(),ge=j.getBoundingClientRect();if(d.dir!=="rtl"){const ot=ge.left-ne.left,Ue=se.left-ot,Ct=te.left-Ue,Je=te.width+Ct,yt=Math.max(Je,ne.width),Mt=window.innerWidth-CONTENT_MARGIN,qt=clamp(Ue,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,Mt-yt)]);g.style.minWidth=Je+"px",g.style.left=qt+"px"}else{const ot=ne.right-ge.right,Ue=window.innerWidth-se.right-ot,Ct=window.innerWidth-te.right-Ue,Je=te.width+Ct,yt=Math.max(Je,ne.width),Mt=window.innerWidth-CONTENT_MARGIN,qt=clamp(Ue,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,Mt-yt)]);g.style.minWidth=Je+"px",g.style.right=qt+"px"}const oe=C(),Ae=window.innerHeight-CONTENT_MARGIN*2,je=M.scrollHeight,Ne=window.getComputedStyle(_),Oe=parseInt(Ne.borderTopWidth,10),Fe=parseInt(Ne.paddingTop,10),ze=parseInt(Ne.borderBottomWidth,10),$e=parseInt(Ne.paddingBottom,10),Be=Oe+Fe+je+$e+ze,qe=Math.min(I.offsetHeight*5,Be),Ge=window.getComputedStyle(M),He=parseInt(Ge.paddingTop,10),Ze=parseInt(Ge.paddingBottom,10),tt=te.top+te.height/2-CONTENT_MARGIN,Ye=Ae-tt,Qe=I.offsetHeight/2,Xe=I.offsetTop+Qe,st=Oe+Fe+Xe,rt=Be-st;if(st<=tt){const ot=oe.length>0&&I===oe[oe.length-1].ref.current;g.style.bottom="0px";const Ue=_.clientHeight-M.offsetTop-M.offsetHeight,Ct=Math.max(Ye,Qe+(ot?Ze:0)+Ue+ze),Je=st+Ct;g.style.height=Je+"px"}else{const ot=oe.length>0&&I===oe[0].ref.current;g.style.top="0px";const Ct=Math.max(tt,Oe+M.offsetTop+(ot?He:0)+Qe)+rt;g.style.height=Ct+"px",M.scrollTop=st-tt+M.offsetTop}g.style.margin=`${CONTENT_MARGIN}px 0`,g.style.minHeight=qe+"px",g.style.maxHeight=Ae+"px",o==null||o(),requestAnimationFrame(()=>E.current=!0)}},[C,d.trigger,d.valueNode,g,_,M,I,j,d.dir,o]);useLayoutEffect2(()=>z(),[z]);const[Q,F]=React__namespace.useState();useLayoutEffect2(()=>{_&&F(window.getComputedStyle(_).zIndex)},[_]);const V=React__namespace.useCallback(te=>{te&&A.current===!0&&(z(),q==null||q(),A.current=!1)},[z,q]);return jsxRuntime.jsx(SelectViewportProvider,{scope:n,contentWrapper:g,shouldExpandOnScrollRef:E,onScrollButtonChange:V,children:jsxRuntime.jsx("div",{ref:b,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:Q},children:jsxRuntime.jsx(Primitive.div,{...l,ref:R,style:{boxSizing:"border-box",maxHeight:"100%",...l.style}})})})});SelectItemAlignedPosition.displayName=ITEM_ALIGNED_POSITION_NAME;var POPPER_POSITION_NAME="SelectPopperPosition",SelectPopperPosition=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,align:o="start",collisionPadding:l=CONTENT_MARGIN,...d}=t,f=usePopperScope$1(n);return jsxRuntime.jsx(Content$1,{...f,...d,ref:e,align:o,collisionPadding:l,style:{boxSizing:"border-box",...d.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$2,{}),VIEWPORT_NAME="SelectViewport",SelectViewport=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:o,...l}=t,d=useSelectContentContext(VIEWPORT_NAME,n),f=useSelectViewportContext(VIEWPORT_NAME,n),g=useComposedRefs(e,d.onViewportChange),b=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:o}),jsxRuntime.jsx(Collection.Slot,{scope:n,children:jsxRuntime.jsx(Primitive.div,{"data-radix-select-viewport":"",role:"presentation",...l,ref:g,style:{position:"relative",flex:1,overflow:"hidden auto",...l.style},onScroll:composeEventHandlers(l.onScroll,_=>{const S=_.currentTarget,{contentWrapper:R,shouldExpandOnScrollRef:C}=f;if(C!=null&&C.current&&R){const E=Math.abs(b.current-S.scrollTop);if(E>0){const A=window.innerHeight-CONTENT_MARGIN*2,M=parseFloat(R.style.minHeight),I=parseFloat(R.style.height),j=Math.max(M,I);if(j<A){const q=j+E,z=Math.min(A,q),Q=q-z;R.style.height=z+"px",R.style.bottom==="0px"&&(S.scrollTop=Q>0?Q:0,R.style.justifyContent="flex-end")}}}b.current=S.scrollTop})})})]})});SelectViewport.displayName=VIEWPORT_NAME;var GROUP_NAME="SelectGroup",[SelectGroupContextProvider,useSelectGroupContext]=createSelectContext(GROUP_NAME),SelectGroup$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t,l=useId();return jsxRuntime.jsx(SelectGroupContextProvider,{scope:n,id:l,children:jsxRuntime.jsx(Primitive.div,{role:"group","aria-labelledby":l,...o,ref:e})})});SelectGroup$1.displayName=GROUP_NAME;var LABEL_NAME="SelectLabel",SelectLabel$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t,l=useSelectGroupContext(LABEL_NAME,n);return jsxRuntime.jsx(Primitive.div,{id:l.id,...o,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:o,disabled:l=!1,textValue:d,...f}=t,g=useSelectContext(ITEM_NAME,n),b=useSelectContentContext(ITEM_NAME,n),_=g.value===o,[S,R]=React__namespace.useState(d??""),[C,E]=React__namespace.useState(!1),A=useComposedRefs(e,q=>{var z;return(z=b.itemRefCallback)==null?void 0:z.call(b,q,o,l)}),M=useId(),I=React__namespace.useRef("touch"),j=()=>{l||(g.onValueChange(o),g.onOpenChange(!1))};if(o==="")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:o,disabled:l,textId:M,isSelected:_,onItemTextChange:React__namespace.useCallback(q=>{R(z=>z||((q==null?void 0:q.textContent)??"").trim())},[]),children:jsxRuntime.jsx(Collection.ItemSlot,{scope:n,value:o,disabled:l,textValue:S,children:jsxRuntime.jsx(Primitive.div,{role:"option","aria-labelledby":M,"data-highlighted":C?"":void 0,"aria-selected":_&&C,"data-state":_?"checked":"unchecked","aria-disabled":l||void 0,"data-disabled":l?"":void 0,tabIndex:l?void 0:-1,...f,ref:A,onFocus:composeEventHandlers(f.onFocus,()=>E(!0)),onBlur:composeEventHandlers(f.onBlur,()=>E(!1)),onClick:composeEventHandlers(f.onClick,()=>{I.current!=="mouse"&&j()}),onPointerUp:composeEventHandlers(f.onPointerUp,()=>{I.current==="mouse"&&j()}),onPointerDown:composeEventHandlers(f.onPointerDown,q=>{I.current=q.pointerType}),onPointerMove:composeEventHandlers(f.onPointerMove,q=>{var z;I.current=q.pointerType,l?(z=b.onItemLeave)==null||z.call(b):I.current==="mouse"&&q.currentTarget.focus({preventScroll:!0})}),onPointerLeave:composeEventHandlers(f.onPointerLeave,q=>{var z;q.currentTarget===document.activeElement&&((z=b.onItemLeave)==null||z.call(b))}),onKeyDown:composeEventHandlers(f.onKeyDown,q=>{var Q;((Q=b.searchRef)==null?void 0:Q.current)!==""&&q.key===" "||(SELECTION_KEYS.includes(q.key)&&j(),q.key===" "&&q.preventDefault())})})})})});SelectItem$1.displayName=ITEM_NAME;var ITEM_TEXT_NAME="SelectItemText",SelectItemText=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,className:o,style:l,...d}=t,f=useSelectContext(ITEM_TEXT_NAME,n),g=useSelectContentContext(ITEM_TEXT_NAME,n),b=useSelectItemContext(ITEM_TEXT_NAME,n),_=useSelectNativeOptionsContext(ITEM_TEXT_NAME,n),[S,R]=React__namespace.useState(null),C=useComposedRefs(e,j=>R(j),b.onItemTextChange,j=>{var q;return(q=g.itemTextRefCallback)==null?void 0:q.call(g,j,b.value,b.disabled)}),E=S==null?void 0:S.textContent,A=React__namespace.useMemo(()=>jsxRuntime.jsx("option",{value:b.value,disabled:b.disabled,children:E},b.value),[b.disabled,b.value,E]),{onNativeOptionAdd:M,onNativeOptionRemove:I}=_;return useLayoutEffect2(()=>(M(A),()=>I(A)),[M,I,A]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Primitive.span,{id:b.textId,...d,ref:C}),b.isSelected&&f.valueNode&&!f.valueNodeHasChildren?ReactDOM__namespace.createPortal(d.children,f.valueNode):null]})});SelectItemText.displayName=ITEM_TEXT_NAME;var ITEM_INDICATOR_NAME="SelectItemIndicator",SelectItemIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t;return useSelectItemContext(ITEM_INDICATOR_NAME,n).isSelected?jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...o,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),o=useSelectViewportContext(SCROLL_UP_BUTTON_NAME,t.__scopeSelect),[l,d]=React__namespace.useState(!1),f=useComposedRefs(e,o.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let g=function(){const _=b.scrollTop>0;d(_)};const b=n.viewport;return g(),b.addEventListener("scroll",g),()=>b.removeEventListener("scroll",g)}},[n.viewport,n.isPositioned]),l?jsxRuntime.jsx(SelectScrollButtonImpl,{...t,ref:f,onAutoScroll:()=>{const{viewport:g,selectedItem:b}=n;g&&b&&(g.scrollTop=g.scrollTop-b.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),o=useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME,t.__scopeSelect),[l,d]=React__namespace.useState(!1),f=useComposedRefs(e,o.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let g=function(){const _=b.scrollHeight-b.clientHeight,S=Math.ceil(b.scrollTop)<_;d(S)};const b=n.viewport;return g(),b.addEventListener("scroll",g),()=>b.removeEventListener("scroll",g)}},[n.viewport,n.isPositioned]),l?jsxRuntime.jsx(SelectScrollButtonImpl,{...t,ref:f,onAutoScroll:()=>{const{viewport:g,selectedItem:b}=n;g&&b&&(g.scrollTop=g.scrollTop+b.offsetHeight)}}):null});SelectScrollDownButton$1.displayName=SCROLL_DOWN_BUTTON_NAME;var SelectScrollButtonImpl=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:o,...l}=t,d=useSelectContentContext("SelectScrollButton",n),f=React__namespace.useRef(null),g=useCollection(n),b=React__namespace.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return React__namespace.useEffect(()=>()=>b(),[b]),useLayoutEffect2(()=>{var S;const _=g().find(R=>R.ref.current===document.activeElement);(S=_==null?void 0:_.ref.current)==null||S.scrollIntoView({block:"nearest"})},[g]),jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...l,ref:e,style:{flexShrink:0,...l.style},onPointerDown:composeEventHandlers(l.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(o,50))}),onPointerMove:composeEventHandlers(l.onPointerMove,()=>{var _;(_=d.onItemLeave)==null||_.call(d),f.current===null&&(f.current=window.setInterval(o,50))}),onPointerLeave:composeEventHandlers(l.onPointerLeave,()=>{b()})})}),SEPARATOR_NAME="SelectSeparator",SelectSeparator$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t;return jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...o,ref:e})});SelectSeparator$1.displayName=SEPARATOR_NAME;var ARROW_NAME$1="SelectArrow",SelectArrow=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t,l=usePopperScope$1(n),d=useSelectContext(ARROW_NAME$1,n),f=useSelectContentContext(ARROW_NAME$1,n);return d.open&&f.position==="popper"?jsxRuntime.jsx(Arrow,{...l,...o,ref:e}):null});SelectArrow.displayName=ARROW_NAME$1;var BUBBLE_INPUT_NAME="SelectBubbleInput",SelectBubbleInput=React__namespace.forwardRef(({__scopeSelect:t,value:e,...n},o)=>{const l=React__namespace.useRef(null),d=useComposedRefs(o,l),f=usePrevious(e);return React__namespace.useEffect(()=>{const g=l.current;if(!g)return;const b=window.HTMLSelectElement.prototype,S=Object.getOwnPropertyDescriptor(b,"value").set;if(f!==e&&S){const R=new Event("change",{bubbles:!0});S.call(g,e),g.dispatchEvent(R)}},[f,e]),jsxRuntime.jsx(Primitive.select,{...n,style:{...VISUALLY_HIDDEN_STYLES,...n.style},ref:d,defaultValue:e})});SelectBubbleInput.displayName=BUBBLE_INPUT_NAME;function shouldShowPlaceholder(t){return t===""||t===void 0}function useTypeaheadSearch(t){const e=useCallbackRef$1(t),n=React__namespace.useRef(""),o=React__namespace.useRef(0),l=React__namespace.useCallback(f=>{const g=n.current+f;e(g),function b(_){n.current=_,window.clearTimeout(o.current),_!==""&&(o.current=window.setTimeout(()=>b(""),1e3))}(g)},[e]),d=React__namespace.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return React__namespace.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,l,d]}function findNextItem(t,e,n){const l=e.length>1&&Array.from(e).every(_=>_===e[0])?e[0]:e,d=n?t.indexOf(n):-1;let f=wrapArray(t,Math.max(d,0));l.length===1&&(f=f.filter(_=>_!==n));const b=f.find(_=>_.textValue.toLowerCase().startsWith(l.toLowerCase()));return b!==n?b:void 0}function wrapArray(t,e){return t.map((n,o)=>t[(e+o)%t.length])}var Root2$2=Select$1,Trigger$1=SelectTrigger$1,Value=SelectValue$1,Icon=SelectIcon,Portal$1=SelectPortal,Content2$2=SelectContent$1,Viewport=SelectViewport,Group=SelectGroup$1,Label=SelectLabel$1,Item$1=SelectItem$1,ItemText=SelectItemText,ItemIndicator=SelectItemIndicator,ScrollUpButton=SelectScrollUpButton$1,ScrollDownButton=SelectScrollDownButton$1,Separator=SelectSeparator$1;const Select=Root2$2,SelectGroup=Group,SelectValue=Value,SelectTrigger=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsxs(Trigger$1,{ref:o,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$1.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",...o},l)=>jsxRuntime.jsx(Portal$1,{children:jsxRuntime.jsxs(Content2$2,{ref:l,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,...o,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$2.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},o)=>jsxRuntime.jsxs(Item$1,{ref:o,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$1.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;const DAYS_OF_WEEK=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function ManufacturerReorderingCard({manufacturer:t,onSave:e,loading:n=!1,saving:o=!1,readonly:l=!1}){const[d,f]=React.useState({...t}),[g,b]=React.useState({...t});React.useEffect(()=>{b({...t}),f({...t})},[t]);const _=(j,q)=>{l||f(z=>({...z,[j]:q}))},S=(j,q)=>{l||f(z=>({...z,[j]:q}))},R=(j,q)=>{l||f(z=>({...z,[j]:q}))},C=()=>{const j={};return Object.keys(d).forEach(q=>{const z=q;JSON.stringify(d[z])!==JSON.stringify(g[z])&&(j[z]=d[z])}),j},E=()=>{if(!o&&!l){const j=C();Object.keys(j).length>0&&e(j)}},A=j=>j===-1?"ASAP":j===void 0||j<0||j>6?"Sunday":DAYS_OF_WEEK[j],M=j=>j==="ASAP"?-1:DAYS_OF_WEEK.indexOf(j),I=Object.keys(C()).length>0;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:d.AutoUpdate,onCheckedChange:j=>_("AutoUpdate",j),disabled:o||l}),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:A(d.AutoReorderDate),onValueChange:j=>S("AutoReorderDate",M(j)),disabled:o||l,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(j=>jsxRuntime.jsx(SelectItem,{value:j,children:j},j))]})]})]}),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:d.DefaultWeeksOfStocking||"",onChange:j=>S("DefaultWeeksOfStocking",Number(j.target.value)),disabled:o||l}),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:d.DefaultMinimumOrder||"",onChange:j=>S("DefaultMinimumOrder",Number(j.target.value)),disabled:o||l})]})]}),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:d.DefaultLeadTime||"",onChange:j=>S("DefaultLeadTime",Number(j.target.value)),disabled:o||l}),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:d.DefaultMaxInventoryValue||"",onChange:j=>S("DefaultMaxInventoryValue",Number(j.target.value)),disabled:o||l})]})]}),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:d.POEmail||"",onChange:j=>R("POEmail",j.target.value),placeholder:"email@example.com",disabled:o||l})]})]})]})}),!l&&jsxRuntime.jsx(CardFooter,{className:"flex justify-end",children:n?jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"}):jsxRuntime.jsxs(Button,{onClick:E,disabled:o||!I,children:[o&&jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Save"]})})]})}var POPOVER_NAME="Popover",[createPopoverContext,createPopoverScope]=createContextScope(POPOVER_NAME,[createPopperScope]),usePopperScope=createPopperScope(),[PopoverProvider,usePopoverContext]=createPopoverContext(POPOVER_NAME),Popover$1=t=>{const{__scopePopover:e,children:n,open:o,defaultOpen:l,onOpenChange:d,modal:f=!1}=t,g=usePopperScope(e),b=React__namespace.useRef(null),[_,S]=React__namespace.useState(!1),[R,C]=useControllableState({prop:o,defaultProp:l??!1,onChange:d,caller:POPOVER_NAME});return jsxRuntime.jsx(Root2$6,{...g,children:jsxRuntime.jsx(PopoverProvider,{scope:e,contentId:useId(),triggerRef:b,open:R,onOpenChange:C,onOpenToggle:React__namespace.useCallback(()=>C(E=>!E),[C]),hasCustomAnchor:_,onCustomAnchorAdd:React__namespace.useCallback(()=>S(!0),[]),onCustomAnchorRemove:React__namespace.useCallback(()=>S(!1),[]),modal:f,children:n})})};Popover$1.displayName=POPOVER_NAME;var ANCHOR_NAME="PopoverAnchor",PopoverAnchor$1=React__namespace.forwardRef((t,e)=>{const{__scopePopover:n,...o}=t,l=usePopoverContext(ANCHOR_NAME,n),d=usePopperScope(n),{onCustomAnchorAdd:f,onCustomAnchorRemove:g}=l;return React__namespace.useEffect(()=>(f(),()=>g()),[f,g]),jsxRuntime.jsx(Anchor,{...d,...o,ref:e})});PopoverAnchor$1.displayName=ANCHOR_NAME;var TRIGGER_NAME$1="PopoverTrigger",PopoverTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopePopover:n,...o}=t,l=usePopoverContext(TRIGGER_NAME$1,n),d=usePopperScope(n),f=useComposedRefs(e,l.triggerRef),g=jsxRuntime.jsx(Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":getState(l.open),...o,ref:f,onClick:composeEventHandlers(t.onClick,l.onOpenToggle)});return l.hasCustomAnchor?g:jsxRuntime.jsx(Anchor,{asChild:!0,...d,children:g})});PopoverTrigger$1.displayName=TRIGGER_NAME$1;var PORTAL_NAME$1="PopoverPortal",[PortalProvider,usePortalContext]=createPopoverContext(PORTAL_NAME$1,{forceMount:void 0}),PopoverPortal=t=>{const{__scopePopover:e,forceMount:n,children:o,container:l}=t,d=usePopoverContext(PORTAL_NAME$1,e);return jsxRuntime.jsx(PortalProvider,{scope:e,forceMount:n,children:jsxRuntime.jsx(Presence,{present:n||d.open,children:jsxRuntime.jsx(Portal$5,{asChild:!0,container:l,children:o})})})};PopoverPortal.displayName=PORTAL_NAME$1;var CONTENT_NAME$1="PopoverContent",PopoverContent$1=React__namespace.forwardRef((t,e)=>{const n=usePortalContext(CONTENT_NAME$1,t.__scopePopover),{forceMount:o=n.forceMount,...l}=t,d=usePopoverContext(CONTENT_NAME$1,t.__scopePopover);return jsxRuntime.jsx(Presence,{present:o||d.open,children:d.modal?jsxRuntime.jsx(PopoverContentModal,{...l,ref:e}):jsxRuntime.jsx(PopoverContentNonModal,{...l,ref:e})})});PopoverContent$1.displayName=CONTENT_NAME$1;var Slot=createSlot("PopoverContent.RemoveScroll"),PopoverContentModal=React__namespace.forwardRef((t,e)=>{const n=usePopoverContext(CONTENT_NAME$1,t.__scopePopover),o=React__namespace.useRef(null),l=useComposedRefs(e,o),d=React__namespace.useRef(!1);return React__namespace.useEffect(()=>{const f=o.current;if(f)return hideOthers(f)},[]),jsxRuntime.jsx(ReactRemoveScroll,{as:Slot,allowPinchZoom:!0,children:jsxRuntime.jsx(PopoverContentImpl,{...t,ref:l,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:composeEventHandlers(t.onCloseAutoFocus,f=>{var g;f.preventDefault(),d.current||(g=n.triggerRef.current)==null||g.focus()}),onPointerDownOutside:composeEventHandlers(t.onPointerDownOutside,f=>{const g=f.detail.originalEvent,b=g.button===0&&g.ctrlKey===!0,_=g.button===2||b;d.current=_},{checkForDefaultPrevented:!1}),onFocusOutside:composeEventHandlers(t.onFocusOutside,f=>f.preventDefault(),{checkForDefaultPrevented:!1})})})}),PopoverContentNonModal=React__namespace.forwardRef((t,e)=>{const n=usePopoverContext(CONTENT_NAME$1,t.__scopePopover),o=React__namespace.useRef(!1),l=React__namespace.useRef(!1);return jsxRuntime.jsx(PopoverContentImpl,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:d=>{var f,g;(f=t.onCloseAutoFocus)==null||f.call(t,d),d.defaultPrevented||(o.current||(g=n.triggerRef.current)==null||g.focus(),d.preventDefault()),o.current=!1,l.current=!1},onInteractOutside:d=>{var b,_;(b=t.onInteractOutside)==null||b.call(t,d),d.defaultPrevented||(o.current=!0,d.detail.originalEvent.type==="pointerdown"&&(l.current=!0));const f=d.target;((_=n.triggerRef.current)==null?void 0:_.contains(f))&&d.preventDefault(),d.detail.originalEvent.type==="focusin"&&l.current&&d.preventDefault()}})}),PopoverContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:o,onOpenAutoFocus:l,onCloseAutoFocus:d,disableOutsidePointerEvents:f,onEscapeKeyDown:g,onPointerDownOutside:b,onFocusOutside:_,onInteractOutside:S,...R}=t,C=usePopoverContext(CONTENT_NAME$1,n),E=usePopperScope(n);return useFocusGuards(),jsxRuntime.jsx(FocusScope,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:l,onUnmountAutoFocus:d,children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:f,onInteractOutside:S,onEscapeKeyDown:g,onPointerDownOutside:b,onFocusOutside:_,onDismiss:()=>C.onOpenChange(!1),children:jsxRuntime.jsx(Content$1,{"data-state":getState(C.open),role:"dialog",id:C.contentId,...E,...R,ref:e,style:{...R.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),CLOSE_NAME="PopoverClose",PopoverClose=React__namespace.forwardRef((t,e)=>{const{__scopePopover:n,...o}=t,l=usePopoverContext(CLOSE_NAME,n);return jsxRuntime.jsx(Primitive.button,{type:"button",...o,ref:e,onClick:composeEventHandlers(t.onClick,()=>l.onOpenChange(!1))})});PopoverClose.displayName=CLOSE_NAME;var ARROW_NAME="PopoverArrow",PopoverArrow=React__namespace.forwardRef((t,e)=>{const{__scopePopover:n,...o}=t,l=usePopperScope(n);return jsxRuntime.jsx(Arrow,{...l,...o,ref:e})});PopoverArrow.displayName=ARROW_NAME;function getState(t){return t?"open":"closed"}var Root2$1=Popover$1,Anchor2=PopoverAnchor$1,Trigger=PopoverTrigger$1,Portal=PopoverPortal,Content2$1=PopoverContent$1;const Popover=Root2$1,PopoverTrigger=Trigger,PopoverAnchor=Anchor2,PopoverContent=React__namespace.forwardRef(({className:t,align:e="center",sideOffset:n=4,...o},l)=>jsxRuntime.jsx(Portal,{children:jsxRuntime.jsx(Content2$1,{ref:l,align:e,sideOffset:n,className:cn("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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-popover-content-transform-origin]",t),...o})}));PopoverContent.displayName=Content2$1.displayName;function MultiSelect({options:t,selected:e,onChange:n,placeholder:o="Select items...",disabled:l=!1}){const[d,f]=React__namespace.useState(!1),[g,b]=React__namespace.useState(""),_=React__namespace.useRef(null),[S,R]=React__namespace.useState(void 0),C=React__namespace.useCallback(()=>{_.current&&R(_.current.offsetWidth)},[]);React__namespace.useLayoutEffect(()=>{C()},[C]),React__namespace.useEffect(()=>(window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)),[C]);const E=I=>{n(e.filter(j=>j!==I))},A=I=>{f(!1),e.includes(I)?n(e.filter(j=>j!==I)):n([...e,I])},M=I=>{I.key==="Enter"&&g&&!t.includes(g)&&!e.includes(g)&&(I.preventDefault(),A(g),b(""))};return jsxRuntime.jsxs(Popover,{open:d,onOpenChange:f,children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{ref:_,variant:"outline",role:"combobox","aria-expanded":d,className:"w-full justify-between h-auto min-h-[40px] py-2",disabled:l,children:[jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 items-center",children:e.length>0?e.map(I=>jsxRuntime.jsxs(Badge,{variant:"outline",className:"mr-1 mb-1",children:[I,jsxRuntime.jsx("span",{className:"ml-1 cursor-pointer ring-offset-background rounded-full outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",onClick:j=>{j.preventDefault(),j.stopPropagation(),E(I)},children:jsxRuntime.jsx(X$1,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},I)):jsxRuntime.jsx("span",{className:"text-muted-foreground",children:o})}),jsxRuntime.jsx(ChevronsUpDown,{className:"h-4 w-4 shrink-0 opacity-50 ml-2"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-full p-0",style:{width:S},children:jsxRuntime.jsxs(Command,{onKeyDown:M,children:[jsxRuntime.jsx(CommandInput,{placeholder:"Search or add custom item...",value:g,onValueChange:b}),jsxRuntime.jsxs(CommandList,{children:[jsxRuntime.jsx(CommandEmpty,{children:"No item found."}),jsxRuntime.jsxs(CommandGroup,{children:[t.filter(I=>!e.includes(I)).map(I=>jsxRuntime.jsxs(CommandItem,{onSelect:()=>A(I),children:[jsxRuntime.jsx(Check,{className:cn("mr-2 h-4 w-4",e.includes(I)?"opacity-100":"opacity-0")}),I]},I)),g&&!t.includes(g)&&!e.includes(g)&&jsxRuntime.jsxs(CommandItem,{onSelect:()=>A(g),children:['Add "',g,'"']})]})]})]})})]})}const imgSizeMap={sm:100,md:200,lg:300,xl:400};function ProductImage({randmarSKU:t,size:e="md",alt:n,secondaryContent:o}){const[l,d]=React__namespace.useState(!1),[f,g]=React__namespace.useState(!1),[b,_]=React__namespace.useState(!1),[S,R]=React__namespace.useState(!1),[C,E]=React__namespace.useState(!1),A=`https://api.randmar.io/Product/${t}/Video`,M=React.useRef(null),I=useIntersectionObserver({elementRef:M,threshold:.1,rootMargin:"100px"});React__namespace.useEffect(()=>{const F=async()=>{try{const te=await(await fetch(A+"/Exists")).json();g(te)}catch(V){console.error("Error checking for video:",V),g(!1)}};I&&!b&&(_(!0),F())},[t,A,I,b]);async function j(){if(f){E(!0);try{const V=await(await fetch(A)).blob(),te=window.URL.createObjectURL(V),ne=document.createElement("a");ne.href=te,ne.download=`${t||"product"}-video.mp4`,document.body.appendChild(ne),ne.click(),document.body.removeChild(ne),window.URL.revokeObjectURL(te)}catch(F){console.error("Error downloading video:",F)}finally{E(!1)}}}function q(){navigator.clipboard.writeText(A),R(!0),setTimeout(()=>{R(!1)},2e3)}function z(){d(!0)}const Q=imgSizeMap[e||"xl"];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Dialog,{open:l,onOpenChange:d,children:jsxRuntime.jsx(DialogContent,{className:"max-w-4xl p-0 overflow-hidden",children:o?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:A,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:o})]}):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:A,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:q,children:S?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:j,disabled:C,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",ref:M,children:[jsxRuntime.jsx("img",{alt:n||`Product ${t}`,className:`rounded-md ${f?"cursor-pointer":""}`,onClick:f?z:void 0,src:`https://api.randmar.io/Product/${t}/Image?width=${Q*1.5}&height=${Q*1.5}`,width:Q,height:Q}),f&&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:z,children:jsxRuntime.jsx(Play,{className:"h-4 w-4"})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Play video"})})]})})]})]})}function ResellerBillingOverviewCard({reseller:t,actions:e,loading:n=!1}){return n||!t?jsxRuntime.jsx(ResellerBillingOverviewSkeleton,{}):jsxRuntime.jsx(ResellerBillingOverviewData,{reseller:t,actions:e})}function ResellerBillingOverviewSkeleton(){return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-40"})})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsx("div",{className:"space-y-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:"space-y-4",children:Array(2).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:"flex justify-end mt-4",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-28 rounded-md"})})]})]})}function ResellerBillingOverviewData({reseller:t,actions:e}){const n=t.Statement||{},o=[{title:"0 - 30 Days",amount:n.Over0||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"},{title:"31 - 45 Days",amount:n.Over30||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"},{title:"45+ Days",amount:n.Over45||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"}],l=[{title:"Total",amount:n.Total||0,icon:jsxRuntime.jsx(DollarSign,{className:"h-5 w-5 text-white"}),color:"bg-green-500"},{title:"Credit Limit",amount:t.CreditLimit||0,icon:jsxRuntime.jsx(CreditCard,{className:"h-5 w-5 text-white"}),color:"bg-blue-500"}];return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Billing Overview"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsx("div",{className:"space-y-4",children:o.map((d,f)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("h3",{className:"text-sm sm:text-base font-medium",children:d.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${d.color}`,children:d.icon})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("p",{className:"text-base sm:text-lg font-bold",children:formatMoney(d.amount)})})]},f))}),jsxRuntime.jsx("div",{className:"space-y-4",children:l.map((d,f)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("h3",{className:"text-sm sm:text-base font-medium",children:d.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${d.color}`,children:d.icon})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("p",{className:"text-base sm:text-lg font-bold",children:formatMoney(d.amount)})})]},f))})]}),e&&jsxRuntime.jsx("div",{className:"flex justify-end mt-4",children:e})]})]})}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,o)=>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"})]},o))})})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Qualifications"})}),jsxRuntime.jsx(CardContent,{children:t&&t.length>0?jsxRuntime.jsx("div",{className:"p-6",children:jsxRuntime.jsx("div",{className:"flex 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,o)=>jsxRuntime.jsx(ManufacturerLogo,{manufacturerId:n.ManufacturerId,opportunityNumber:n.DefaultOpportunityNumber},`${n.ManufacturerId}-${o}`))})}):jsxRuntime.jsx("p",{children:"No qualification available."})})]})}function ManufacturerLogo({manufacturerId:t,opportunityNumber:e}){return jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("div",{className:"h-12 w-full items-center justify-center mb-2",children:jsxRuntime.jsx(PartnerLogo,{id:t,width:96,height:48})}),e&&jsxRuntime.jsx(Badge,{variant:"outline",className:"text-xs",children:e})]})}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=[{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"}];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:n.map((o,l)=>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:o.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${o.color}`,children:o.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:formatMoney(o.amount)})]})]},l))}),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(SalesChart,{statistics:e,chartHeight:300,mode:"week"})})]})})]})]})}var ROOT_NAME="AlertDialog",[createAlertDialogContext,createAlertDialogScope]=createContextScope(ROOT_NAME,[createDialogScope]),useDialogScope=createDialogScope(),AlertDialog$1=t=>{const{__scopeAlertDialog:e,...n}=t,o=useDialogScope(e);return jsxRuntime.jsx(Root$8,{...o,...n,modal:!0})};AlertDialog$1.displayName=ROOT_NAME;var TRIGGER_NAME="AlertDialogTrigger",AlertDialogTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...o}=t,l=useDialogScope(n);return jsxRuntime.jsx(Trigger$5,{...l,...o,ref:e})});AlertDialogTrigger$1.displayName=TRIGGER_NAME;var PORTAL_NAME="AlertDialogPortal",AlertDialogPortal$1=t=>{const{__scopeAlertDialog:e,...n}=t,o=useDialogScope(e);return jsxRuntime.jsx(Portal$4,{...o,...n})};AlertDialogPortal$1.displayName=PORTAL_NAME;var OVERLAY_NAME="AlertDialogOverlay",AlertDialogOverlay$1=React__namespace.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...o}=t,l=useDialogScope(n);return jsxRuntime.jsx(Overlay,{...l,...o,ref:e})});AlertDialogOverlay$1.displayName=OVERLAY_NAME;var CONTENT_NAME="AlertDialogContent",[AlertDialogContentProvider,useAlertDialogContentContext]=createAlertDialogContext(CONTENT_NAME),Slottable=createSlottable("AlertDialogContent"),AlertDialogContent$1=React__namespace.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:o,...l}=t,d=useDialogScope(n),f=React__namespace.useRef(null),g=useComposedRefs(e,f),b=React__namespace.useRef(null);return jsxRuntime.jsx(WarningProvider,{contentName:CONTENT_NAME,titleName:TITLE_NAME,docsSlug:"alert-dialog",children:jsxRuntime.jsx(AlertDialogContentProvider,{scope:n,cancelRef:b,children:jsxRuntime.jsxs(Content$2,{role:"alertdialog",...d,...l,ref:g,onOpenAutoFocus:composeEventHandlers(l.onOpenAutoFocus,_=>{var S;_.preventDefault(),(S=b.current)==null||S.focus({preventScroll:!0})}),onPointerDownOutside:_=>_.preventDefault(),onInteractOutside:_=>_.preventDefault(),children:[jsxRuntime.jsx(Slottable,{children:o}),jsxRuntime.jsx(DescriptionWarning,{contentRef:f})]})})})});AlertDialogContent$1.displayName=CONTENT_NAME;var TITLE_NAME="AlertDialogTitle",AlertDialogTitle$1=React__namespace.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...o}=t,l=useDialogScope(n);return jsxRuntime.jsx(Title$1,{...l,...o,ref:e})});AlertDialogTitle$1.displayName=TITLE_NAME;var DESCRIPTION_NAME="AlertDialogDescription",AlertDialogDescription$1=React__namespace.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...o}=t,l=useDialogScope(n);return jsxRuntime.jsx(Description$1,{...l,...o,ref:e})});AlertDialogDescription$1.displayName=DESCRIPTION_NAME;var ACTION_NAME="AlertDialogAction",AlertDialogAction$1=React__namespace.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...o}=t,l=useDialogScope(n);return jsxRuntime.jsx(Close$1,{...l,...o,ref:e})});AlertDialogAction$1.displayName=ACTION_NAME;var CANCEL_NAME="AlertDialogCancel",AlertDialogCancel$1=React__namespace.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...o}=t,{cancelRef:l}=useAlertDialogContentContext(CANCEL_NAME,n),d=useDialogScope(n),f=useComposedRefs(e,l);return jsxRuntime.jsx(Close$1,{...d,...o,ref:f})});AlertDialogCancel$1.displayName=CANCEL_NAME;var DescriptionWarning=({contentRef:t})=>{const e=`\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
1139
1139
 
1140
1140
  You can add a description to the \`${CONTENT_NAME}\` by passing a \`${DESCRIPTION_NAME}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
1141
1141
 
@@ -1319,6 +1319,6 @@ img.ProseMirror-separator {
1319
1319
  .ProseMirror p {
1320
1320
  margin-bottom: 0.5em;
1321
1321
  }
1322
- `;function RichTextEditor({id:t,name:e,value:n,onChange:o,placeholder:l,className:d,...f}){const[g,b]=React.useState(!1),_=React.useRef(null),S=React.useRef(null),R=useEditor({extensions:[StarterKit,Underline],content:n,editorProps:{attributes:{class:"prose prose-sm sm:prose dark:prose-invert focus:outline-none",id:t??"",name:e??""}},onUpdate:({editor:j})=>{const q=j.getHTML();o({target:{id:t,name:e,value:q}})}});React.useEffect(()=>{R&&n!==R.getHTML()&&R.commands.setContent(n)},[n,R]);const C=React.useCallback(j=>{if(R)if(R.chain().focus(),j==="paragraph")R.chain().setParagraph().run();else{const q=Number.parseInt(j.slice(1));R.chain().setHeading({level:q}).run()}},[R]),E=React.useCallback(j=>{if(R)switch(R.chain().focus(),j){case"bold":R.chain().toggleBold().run();break;case"italic":R.chain().toggleItalic().run();break;case"underline":R.chain().toggleUnderline().run();break;case"strike":R.chain().toggleStrike().run();break;case"bulletList":R.chain().toggleBulletList().run();break;case"orderedList":R.chain().toggleOrderedList().run();break}},[R]),A=React.useCallback(()=>{b(j=>!j)},[]),M=React.useCallback(j=>{const q=j.target.value;R&&R.commands.setContent(q),o({target:{id:t,name:e,value:q}})},[o,R,t,e]),I=React.useCallback(()=>{!g&&R&&R.commands.focus()},[g,R]);return R?jsxRuntime.jsxs("div",{ref:S,className:cn("border border-input rounded-md overflow-hidden focus-within:outline-hidden focus-within:ring-1 focus-within:ring-ring",d),onClick:I,...f,children:[jsxRuntime.jsx("style",{children:editorStyles}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center p-2 border-b border-input gap-2 bg-background",children:[jsxRuntime.jsxs(Select,{onValueChange:C,disabled:g,children:[jsxRuntime.jsx(SelectTrigger,{className:"w-[160px]",children:jsxRuntime.jsx(SelectValue,{placeholder:"Format"})}),jsxRuntime.jsx(SelectContent,{children:formatOptions.map(j=>jsxRuntime.jsx(SelectItem,{value:j.value,children:j.label},j.value))})]}),["bold","italic","underline","strike","bulletList","orderedList"].map(j=>jsxRuntime.jsxs(Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>E(j),className:R.isActive(j)?"bg-muted":"",disabled:g,children:[j==="bold"&&jsxRuntime.jsx(Bold$1,{className:"h-4 w-4"}),j==="italic"&&jsxRuntime.jsx(Italic$1,{className:"h-4 w-4"}),j==="underline"&&jsxRuntime.jsx(Underline$1,{className:"h-4 w-4"}),j==="strike"&&jsxRuntime.jsx(Strikethrough,{className:"h-4 w-4"}),j==="bulletList"&&jsxRuntime.jsx(List$1,{className:"h-4 w-4"}),j==="orderedList"&&jsxRuntime.jsx(ListOrdered,{className:"h-4 w-4"})]},j)),jsxRuntime.jsx(Button,{type:"button",variant:"ghost",size:"sm",onClick:A,className:g?"bg-muted":"",children:jsxRuntime.jsx(Code$1,{className:"h-4 w-4"})})]}),jsxRuntime.jsx("div",{className:"p-3",children:g?jsxRuntime.jsx(Textarea,{ref:_,id:t,name:e,value:R.getHTML(),onChange:M,className:cn("min-h-[150px] font-mono text-sm resize-none border-0 focus-visible:ring-0 focus-visible:ring-offset-0",d),placeholder:l}):jsxRuntime.jsx(EditorContent,{editor:R})})]}):null}function ReceiptsTable({receipts:t=null,loading:e=!1}){const n=React.useMemo(()=>[{accessorKey:"Location",header:"Location",cell:({row:d})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:d.original.Location??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"ReceiptDate",header:"Date",cell:({row:d})=>formatYYYYMMDDIntToDateString(d.original.ReceiptDate),enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:d})=>d.original.Quantity??"N/A",enableSorting:!0,enableFiltering:!0}],[]),o=React.useMemo(()=>{const d={};if(t){const f=Array.from(new Set(t.map(b=>b.Location).filter(b=>b!=null)));d.Location=f;const g=Array.from(new Set(t.map(b=>formatYYYYMMDDIntToDateString(b.ReceiptDate)).filter(b=>b!=="N/A"&&b!=="Invalid Date"))).sort((b,_)=>new Date(_).getTime()-new Date(b).getTime());d.ReceiptDate=g}return d},[t]),l=t||[];return jsxRuntime.jsx(DataTable,{columns:n,data:l,uniqueValues:o,loading:e,tableClass:"bg-card text-card-foreground"})}const formatDate$1=t=>{if(!t)return"N/A";try{const e=new Date(t);return isNaN(e.getTime())?"Invalid Date":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return"Invalid Date"}},getStatusVariant=t=>{const e=(t==null?void 0:t.toLowerCase())||"";return e.includes("accepted")?"success":e.includes("error")||e.includes("rejected")?"destructive":"neutral"};function ReturnsTable({applicationId:t,returns:e=null,loading:n=!1}){const o=React.useMemo(()=>[{accessorKey:"ReturnNumber1",header:"RMA Number",cell:({row:f})=>{const g=f.original.ReturnNumber1||f.original.ReturnNumber;return g?jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:`/${t}/Return/${g}`,className:"font-medium text-primary hover:underline",children:g})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["View details for return ",g]})})]})}):"N/A"},enableSorting:!0,enableFiltering:!0},{accessorKey:"RequestDate",header:"Request Date",cell:({row:f})=>formatDate$1(f.original.RequestDate),enableSorting:!0},{accessorKey:"InvoiceNumber",header:"Invoice Number",cell:({row:f})=>{const g=f.original.InvoiceNumber;return g?jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:`/${t}/Document/${g}`,className:"text-blue-600 hover:underline dark:text-blue-400",children:g})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["View details for invoice ",g]})})]})}):"N/A"},enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:f})=>f.original.Quantity??"0",enableSorting:!0},{accessorKey:"ReasonForReturn",header:"Return Reason",cell:({row:f})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:f.original.ReasonForReturn??"—"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"Status",header:"Status",cell:({row:f})=>{const g=f.original.Status,b=getStatusVariant(g);let _="border-gray-400 bg-gray-100 text-gray-600 dark:border-gray-600 dark:bg-gray-800/50 dark:text-gray-400";return b==="success"?_="border-green-500 bg-green-100 text-green-700 dark:border-green-600 dark:bg-green-900/50 dark:text-green-400":b==="destructive"&&(_="border-red-500 bg-red-100 text-red-700 dark:border-red-600 dark:bg-red-900/50 dark:text-red-400"),g?jsxRuntime.jsx(Badge,{variant:"outline",className:`${_} font-medium`,children:g}):"—"},enableSorting:!0,enableFiltering:!0},{accessorKey:"WarehouseLocation",header:"Warehouse",cell:({row:f})=>f.original.WarehouseLocation??"—",enableSorting:!0,enableFiltering:!0},{accessorKey:"LastUpdatedDate",header:"Last Update",cell:({row:f})=>formatDate$1(f.original.LastUpdatedDate)!=="N/A"?formatDate$1(f.original.LastUpdatedDate):"—",enableSorting:!0}],[t]),l=React.useMemo(()=>{const f={};if(e){const g=Array.from(new Set(e.map(S=>S.Status).filter(Boolean)));f.Status=g;const b=Array.from(new Set(e.map(S=>S.ReasonForReturn).filter(Boolean)));f.ReasonForReturn=b;const _=Array.from(new Set(e.map(S=>S.WarehouseLocation).filter(Boolean)));f.WarehouseLocation=_}return f},[e]),d=React.useMemo(()=>e?[...e].sort((g,b)=>(b.ReturnNumber1||b.ReturnNumber||"").localeCompare(g.ReturnNumber1||g.ReturnNumber||"")):[],[e]);return n?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-48"})}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-48 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Returns"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:o,data:d,uniqueValues:l})})]})}function InvoicesTable({applicationId:t,invoices:e=null,loading:n=!1}){const o=React.useMemo(()=>[{accessorKey:"InvoiceNumber",header:"Number",cell:({row:f})=>f.original.InvoiceNumber?jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:`/${t}/Document/${f.original.InvoiceNumber}`,className:"font-medium text-primary hover:underline",children:f.original.InvoiceNumber})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["View details for invoice ",f.original.InvoiceNumber]})})]})}):"—",enableSorting:!0,enableFiltering:!0},{accessorKey:"InvoiceDate",header:"Date",cell:({row:f})=>formatYYYYMMDDIntToDateString(f.original.InvoiceDate),enableSorting:!0,enableFiltering:!0},{accessorKey:"OrderNumber",header:"Order Number",cell:({row:f})=>f.original.OrderNumber?jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:`/${t}/GeneralDocument/${f.original.OrderNumber}`,className:"font-medium text-primary hover:underline",children:f.original.OrderNumber})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["View details for order ",f.original.OrderNumber]})})]})}):"—",enableSorting:!0,enableFiltering:!0},{accessorKey:"PONumber",header:"PO Number",cell:({row:f})=>f.original.PONumber&&f.original.PONumber.trim().length>0?f.original.PONumber:"—",enableSorting:!0,enableFiltering:!0},{accessorKey:"ShipToName",header:"Ship To Name",cell:({row:f})=>f.original.ShipToName??"—",enableSorting:!0,enableFiltering:!0},{accessorKey:"QuantityOrdered",header:"Quantity Ordered",cell:({row:f})=>f.original.QuantityOrdered??0,enableSorting:!0,enableFiltering:!0},{accessorKey:"UnitPrice",header:"Unit Price",cell:({row:f})=>formatMoney(f.original.UnitPrice??0),enableSorting:!0,enableFiltering:!0},{accessorKey:"Location",header:"Location",cell:({row:f})=>f.original.Location??"—",enableSorting:!0,enableFiltering:!0}],[t]),l=React.useMemo(()=>{const f={};if(e){const g=Array.from(new Set(e.map(C=>C.ShipToName).filter(C=>C!=null)));f.ShipToName=g;const b=Array.from(new Set(e.map(C=>C.InvoiceNumber).filter(C=>C!=null)));f.InvoiceNumber=b;const _=Array.from(new Set(e.map(C=>C.OrderNumber).filter(C=>C!=null)));f.OrderNumber=_;const S=Array.from(new Set(e.map(C=>C.PONumber).filter(C=>C!=null)));f.PONumber=S;const R=Array.from(new Set(e.map(C=>C.Location).filter(C=>C!=null)));f.Location=R}return f},[e]),d=e||[];return jsxRuntime.jsx(DataTable,{columns:o,data:d,uniqueValues:l,loading:n,tableClass:"bg-card text-card-foreground"})}function ProductOverviewPage({applicationId:t,sku:e,productDefaultOpportunityNumber:n="",productOnAddToCart:o,productAddingToCart:l=!1,productShopifyHostname:d,productCustomAction:f=jsxRuntime.jsx(jsxRuntime.Fragment,{})}){var I,j,q,z,Q,F,V,te,ne,se,ge,oe;const{data:g,isLoading:b}=useGetV4PartnerByRouteApplicationIdProductAndRandmarSkuQuery({routeApplicationId:t,randmarSku:e,withSpecification:!1},{skip:!t||!e}),{data:_,isLoading:S}=useGetV4PartnerByRouteApplicationIdProductAndRandmarSkuQuery({routeApplicationId:t,randmarSku:e,withSpecification:!0},{skip:!g}),[R,C]=React.useState("stats"),[E,A]=React.useState(!1);React.useEffect(()=>{var Ne,Oe,Fe,ze,$e,Be,qe,Ge;if(S||!_){A(!1);return}const Ae={stats:(((Ne=_==null?void 0:_.SalesStatistics)==null?void 0:Ne.length)??0)<=0,inventory:(((Fe=(Oe=_==null?void 0:_.Distribution)==null?void 0:Oe.Inventory)==null?void 0:Fe.length)??0)<=0,opportunities:(((ze=_==null?void 0:_.Opportunities)==null?void 0:ze.length)??0)<=0,orders:((($e=_==null?void 0:_.ActiveOrderDetails)==null?void 0:$e.length)??0)<=0&&(((Be=_==null?void 0:_.Returns)==null?void 0:Be.length)??0)<=0,invoices:(((qe=_==null?void 0:_.CompletedOrderDetails)==null?void 0:qe.length)??0)<=0,warehouse:(((Ge=_==null?void 0:_.Receipts)==null?void 0:Ge.length)??0)<=0},je=Object.values(Ae).some(He=>!He);if(A(je),je&&Ae[R]){const He=Object.keys(Ae).find(Ze=>!Ae[Ze]);He&&C(He)}},[S,_,R]);const M=(g==null?void 0:g.ManufacturerId)!==t;return console.log("readonly",M),jsxRuntime.jsxs("div",{className:"@container",children:[jsxRuntime.jsxs("div",{className:"grid gap-4 grid-cols-1 @sm:grid-cols-2 @md:grid-cols-3",children:[jsxRuntime.jsx("div",{className:"@md:col-span-2",children:jsxRuntime.jsx(ProductCard,{applicationId:t,product:_||g,defaultOpportunityNumber:n,onAddToCart:o,addingToCart:l,shopifyHostname:d,customAction:f})}),jsxRuntime.jsxs(Card,{className:"flex flex-col",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsxs(CardTitle,{children:[jsxRuntime.jsx(Info,{className:"h-5 w-5 inline mr-2"})," Additionnal information"]})}),jsxRuntime.jsx(CardContent,{className:"basis-0 mb-6 grow overflow-y-auto",children:b?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsx(Skeleton,{className:"h-1 w-full my-6"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full mt-2"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full mt-1"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Cateory Name"}),jsxRuntime.jsx("span",{className:"font-medium",children:(g==null?void 0:g.ProductType)||"N/A"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Master Carton"}),jsxRuntime.jsx("span",{className:"font-medium",children:(g==null?void 0:g.MasterCarton)||"N/A"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Skid Quantity"}),jsxRuntime.jsx("span",{className:"font-medium",children:(g==null?void 0:g.SkidQuantity)||"N/A"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Automatic Reorder"}),jsxRuntime.jsx("span",{className:"font-medium",children:g!=null&&g.AutoUpdate?"Yes":"No"})]}),((g==null?void 0:g.VoiceoverCaption)||(g==null?void 0:g.BodyHTML))&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("hr",{className:"my-6"}),jsxRuntime.jsx("div",{className:"text-muted-foreground mb-2",children:"Description"}),(g==null?void 0:g.VoiceoverCaption)&&jsxRuntime.jsx("div",{children:g==null?void 0:g.VoiceoverCaption}),(g==null?void 0:g.BodyHTML)&&jsxRuntime.jsx("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:(g==null?void 0:g.BodyHTML)??""}})]})]})})]})]}),jsxRuntime.jsx("div",{className:"my-4",children:b||S?jsxRuntime.jsx("div",{className:"mx-auto flex justify-center items-center h-32",children:jsxRuntime.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin text-primary"})}):E&&jsxRuntime.jsxs(Tabs,{value:R,onValueChange:C,children:[jsxRuntime.jsxs(TabsList,{className:"inline-flex h-auto items-center justify-center rounded-none border-b bg-transparent p-0",children:[jsxRuntime.jsx(TabsTrigger,{value:"stats",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",disabled:(((I=_==null?void 0:_.SalesStatistics)==null?void 0:I.length)??0)<=0,children:"Statistics"}),jsxRuntime.jsx(TabsTrigger,{value:"inventory",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",disabled:(((q=(j=_==null?void 0:_.Distribution)==null?void 0:j.Inventory)==null?void 0:q.length)??0)<=0,children:"Inventory"}),jsxRuntime.jsx(TabsTrigger,{value:"opportunities",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",disabled:(((z=_==null?void 0:_.Opportunities)==null?void 0:z.length)??0)<=0,children:"Opportunities"}),jsxRuntime.jsx(TabsTrigger,{value:"orders",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",disabled:(((Q=_==null?void 0:_.ActiveOrderDetails)==null?void 0:Q.length)??0)<=0&&(((F=_==null?void 0:_.Returns)==null?void 0:F.length)??0)<=0,children:"Orders"}),jsxRuntime.jsx(TabsTrigger,{value:"invoices",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",disabled:(((V=_==null?void 0:_.Invoices)==null?void 0:V.length)??0)<=0,children:"Invoices"}),jsxRuntime.jsx(TabsTrigger,{value:"warehouse",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",disabled:(((te=_==null?void 0:_.Receipts)==null?void 0:te.length)??0)<=0,children:"Latest Warehouse Receiving"})]}),jsxRuntime.jsx(TabsContent,{value:"stats",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(SalesChartCard,{statistics:(_==null?void 0:_.SalesStatistics)??[],loading:S})})}),jsxRuntime.jsx(TabsContent,{value:"inventory",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ProductInventoryGrid,{inventory:((ne=_==null?void 0:_.Distribution)==null?void 0:ne.Inventory)??[],className:"bg-card text-card-foreground"})})}),jsxRuntime.jsx(TabsContent,{value:"opportunities",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(OpportunitiesTable,{applicationId:t,opportunities:g==null?void 0:g.Opportunities,loading:b})})}),jsxRuntime.jsxs(TabsContent,{value:"orders",children:[(((se=_==null?void 0:_.ActiveOrderDetails)==null?void 0:se.length)??0)>0&&jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(OrdersCard,{applicationId:t,title:"Open Orders",orders:_==null?void 0:_.ActiveOrderDetails,loading:S})}),(((ge=_==null?void 0:_.Returns)==null?void 0:ge.length)??0)>0&&jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ReturnsTable,{applicationId:t,returns:_==null?void 0:_.Returns,loading:S})})]}),jsxRuntime.jsx(TabsContent,{value:"invoices",children:(((oe=_==null?void 0:_.Invoices)==null?void 0:oe.length)??0)>0&&jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(InvoicesTable,{applicationId:t,invoices:_==null?void 0:_.Invoices,loading:S})})}),jsxRuntime.jsx(TabsContent,{value:"warehouse",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ReceiptsTable,{receipts:_==null?void 0:_.Receipts,loading:S})})})]})})]})}function AssistantChat(t){return jsxRuntime.jsx(Card,{className:"max-w-6xl",children:jsxRuntime.jsx(ChatLayout,{className:"h-[40em]",userId:t.userId,userName:t.userName,assistantOnly:!0,initialPrompt:t.initialPrompt})})}function getEndDateStatus(t){if(!t)return{text:"No End Date",variant:"neutral",daysRemaining:null};const e=new Date(t);if(isNaN(e.getTime()))return{text:"Invalid Date",variant:"neutral",daysRemaining:null};const n=new Date,o=new Date(e.getFullYear(),e.getMonth(),e.getDate()),l=new Date(n.getFullYear(),n.getMonth(),n.getDate()),d=o.getTime()-l.getTime(),f=Math.ceil(d/(1e3*60*60*24));return f<0?{text:`Ended ${Math.abs(f)}d ago`,variant:"destructive",daysRemaining:f}:f===0?{text:"Ends today",variant:"destructive",daysRemaining:f}:f<=7?{text:`Ends in ${f}d`,variant:"destructive",daysRemaining:f}:f<=30?{text:`Ends in ${f}d`,variant:"warning",daysRemaining:f}:{text:`Ends in ${f}d`,variant:"neutral",daysRemaining:f}}const formatDate=t=>{if(!t)return"N/A";try{const e=new Date(t);return isNaN(e.getTime())?"Invalid Date":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return"Invalid Date"}};function OpportunitiesTable({applicationId:t,opportunities:e=null,loading:n=!1}){var te;const{toast:o}=useToast(),[l,d]=React.useState({}),[f,g]=React.useState(!1),[b,_]=React.useState(""),[S,R]=React.useState(null),{data:C}=useGetV4PartnerByApplicationIdAccountQuery({applicationId:t},{skip:!t}),E=React.useCallback((ne,se,ge)=>{d(oe=>({...oe,[ne]:{...oe[ne],[se]:ge}}))},[]),[A]=usePutV4ResellerByRouteResellerIdOpportunityAndManufacturerIdDefaultMutation(),M=React.useCallback(async ne=>{if(!(C!=null&&C.IsReseller))return;if(!ne.BidNumber){o({title:"Error",description:"Bid Number is missing, cannot set default.",variant:"destructive"});return}const se=ne.BidNumber;E(se,"isSettingDefault",!0),A({routeResellerId:t,manufacturerId:ne.ManufacturerId??"",opportunityNumber:se}).unwrap().then(()=>{o({title:"Success",description:`Opportunity "${ne.OpportunityName||ne.Opportunity||se}" was successfully set as default.`,variant:"success"})}).catch(ge=>{var oe;console.error("Set as default error:",ge),o({title:"Error",description:((oe=ge.data)==null?void 0:oe.message)||ge.message||"An error occurred while setting this opportunity as default.",variant:"destructive"})}).finally(()=>{E(se,"isSettingDefault",!1)})},[t,A,o,E]),[I]=usePostV4ResellerByRouteResellerIdOpportunityAndManufacturerIdBidNumberEmailMutation(),j=React.useCallback(ne=>{if(C!=null&&C.IsReseller){if(!ne.BidNumber){o({title:"Error",description:"Bid Number is missing, cannot prepare report.",variant:"destructive"});return}R(ne),_(""),g(!0)}},[o]),q=React.useCallback(async()=>{if(!(C!=null&&C.IsReseller))return;if(!S||!S.BidNumber){o({title:"Error",description:"No opportunity selected or Bid Number is missing.",variant:"destructive"});return}if(!b.trim()||!/\S+@\S+\.\S+/.test(b)){o({title:"Validation Error",description:"Please enter a valid email address.",variant:"destructive"});return}const ne=S.BidNumber;E(ne,"isSendingReport",!0),I({routeResellerId:t,manufacturerId:S.ManufacturerId??"",bidNumber:ne,emailAddress:b}).unwrap().then(()=>{o({title:"Success",description:`A report for "${S.OpportunityName||S.Opportunity||ne}" was successfully sent to ${b}.`,variant:"success"}),g(!1)}).catch(se=>{var ge;console.error("Send report by email error:",se),o({title:"Error",description:((ge=se.data)==null?void 0:ge.message)||se.message||"An error occurred while sending the report by email.",variant:"destructive"})}).finally(()=>{E(ne,"isSendingReport",!1),f||(R(null),_(""))})},[S,b,t,I,o,E,g]),z=React.useMemo(()=>[{accessorKey:"ManufacturerId",header:"Manuf.",cell:({row:ne})=>jsxRuntime.jsx("div",{className:"w-20 h-8",children:jsxRuntime.jsx(PartnerLogo,{id:ne.original.ManufacturerId,width:80,height:32})}),enableSorting:!0,enableFiltering:!0},{id:"opportunityDisplay",accessorFn:ne=>ne.OpportunityName||ne.Opportunity,header:"Opportunity",cell:({getValue:ne})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:ne()??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"BidNumber",header:"Bid Number",cell:({row:ne})=>ne.original.BidNumber??"N/A",enableSorting:!0,enableFiltering:!0},{id:"statusInfo",header:"Status",cell:({row:ne})=>{const se=ne.original,ge=se.Active===!0,oe=getEndDateStatus(se.EndDate);let Ae="border-gray-400 bg-gray-100 text-gray-600 dark:border-gray-600 dark:bg-gray-800/50 dark:text-gray-400";return oe.variant==="destructive"?Ae="border-red-500 bg-red-100 text-red-700 dark:border-red-600 dark:bg-red-900/50 dark:text-red-400":oe.variant==="warning"&&(Ae="border-yellow-500 bg-yellow-100 text-yellow-700 dark:border-yellow-600 dark:bg-yellow-900/50 dark:text-yellow-400"),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 min-w-[200px]",children:[jsxRuntime.jsx(Badge,{variant:"outline",className:ge?"border-green-500 bg-green-100 text-green-700 dark:border-green-600 dark:bg-green-900/50 dark:text-green-400 font-medium":"border-gray-400 bg-gray-100 text-gray-600 dark:border-gray-600 dark:bg-gray-800/50 dark:text-gray-400 font-medium",children:ge?"Active":"Inactive"}),se.EndDate&&jsxRuntime.jsx(Badge,{variant:"outline",className:`${Ae} font-medium`,children:oe.text}),jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"h-6 w-6 p-0 data-[state=delayed-open]:bg-accent data-[state=instant-open]:bg-accent",children:jsxRuntime.jsx(Info,{className:"h-4 w-4 text-muted-foreground"})})}),jsxRuntime.jsx(TooltipContent,{side:"top",align:"center",className:"bg-popover text-popover-foreground p-2 rounded shadow-lg",children:jsxRuntime.jsxs("div",{className:"text-sm space-y-1",children:[jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"Start:"})," ",formatDate(se.StartDate)]}),jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"End:"})," ",formatDate(se.EndDate)]}),jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"Updated:"})," ",formatDate(se.LastUpdate)]})]})})]})})]})},enableFiltering:!1},{id:"actions",header:"Actions",cell:({row:ne})=>{var Oe,Fe;const se=ne.original;if(!se.BidNumber)return jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"Actions unavailable"});const ge=se.BidNumber,oe=(Oe=l[ge])==null?void 0:Oe.isSettingDefault,Ae=(S==null?void 0:S.BidNumber)===ge&&((Fe=l[ge])==null?void 0:Fe.isSendingReport),je=oe||Ae,Ne=se.CanBeSetAsDefault===!0;return jsxRuntime.jsxs("div",{className:"flex space-x-2",children:[jsxRuntime.jsx("a",{href:`/${t}/Opportunity/${se.ManufacturerId}/${se.BidNumber}`,children:jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",className:"flex items-center",children:[jsxRuntime.jsx(Star,{className:"mr-2 h-4 w-4"})," View"]})}),(C==null?void 0:C.IsReseller)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",onClick:()=>M(se),disabled:je||!Ne,title:Ne?"Set as default":"This opportunity cannot be set as default",className:"flex items-center",children:[oe?jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}):jsxRuntime.jsx(Star,{className:"mr-2 h-4 w-4"})," Set Default"]}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",onClick:()=>j(se),disabled:je,title:"Send report by email",className:"flex items-center",children:[Ae?jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}):jsxRuntime.jsx(Send,{className:"mr-2 h-4 w-4"})," Send Report"]})]})]})}}],[l,M,j,S]),Q=React.useMemo(()=>{const ne={};if(e){const se=Array.from(new Set(e.map(oe=>oe.ManufacturerId).filter(oe=>oe!=null)));ne.ManufacturerId=se;const ge=Array.from(new Set(e.map(oe=>oe.OpportunityName||oe.Opportunity).filter(oe=>oe!=null)));ne.opportunityDisplay=ge}return ne},[e]),F=e||[],V=S!=null&&S.BidNumber?(te=l[S.BidNumber])==null?void 0:te.isSendingReport:!1;return n?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-48"})," "]}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-48 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"})," ",jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"})," ",jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})," ",jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Opportunities"})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:z,data:F,uniqueValues:Q})})]}),jsxRuntime.jsx(Dialog,{open:f,onOpenChange:ne=>{g(ne),ne||(R(null),_(""))},children:jsxRuntime.jsxs(DialogContent,{className:"@sm:max-w-[425px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Send Opportunity Report"}),jsxRuntime.jsxs(DialogDescription,{children:["Enter the email address to send the report for opportunity: ",jsxRuntime.jsx("br",{}),jsxRuntime.jsx("span",{className:"font-semibold",children:(S==null?void 0:S.OpportunityName)||(S==null?void 0:S.Opportunity)||"N/A"}),(S==null?void 0:S.BidNumber)&&jsxRuntime.jsxs("span",{className:"block text-sm text-muted-foreground",children:["Bid Number: ",S.BidNumber]})]})]}),jsxRuntime.jsx("div",{className:"grid gap-4 py-4",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",className:"text-right",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",type:"email",value:b,onChange:ne=>_(ne.target.value),placeholder:"recipient@example.com",className:"col-span-3",disabled:V})]})}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>g(!1),disabled:V,children:"Cancel"}),jsxRuntime.jsxs(Button,{type:"submit",onClick:q,disabled:V,children:[V&&jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"})," Send Report"]})]})]})})]})}function useLoadScript(t){const[e,n]=React.useState(!0),[o,l]=React.useState(null),[d,f]=React.useState(!1),g=()=>{n(!1),f(!0)};return React.useEffect(()=>{if(!document){const R=new Error(`[ScriptLoadingError] document not defined when attempting to load ${t}`);l(R);return}const b=document.querySelector(`script[src="${t}"]`);if(b!=null&&b.dataset.loaded){g();return}const _=b||document.createElement("script");b||(_.src=t);const S=()=>{_.dataset.loaded="1",g()};_.addEventListener("load",S),_.addEventListener("error",R=>{console.error("Failed to load script:",t,R);const C=new Error(`[ScriptLoadingError] Failed to load script: ${t}`);l(C)}),b||document.head.append(_)},[]),{isLoading:e,error:o,isSuccess:d}}const isGoogleReady=t=>t&&t.charts,isGoogleChartsReady=(t,e)=>{const{controls:n,toolbarItems:o,getChartEditor:l}=t;return e&&e.charts&&e.visualization&&e.visualization.ChartWrapper&&e.visualization.Dashboard&&(!n||e.visualization.ChartWrapper)&&(!l||e.visualization.ChartEditor)&&(!o||e.visualization.drawToolbar)},getGoogleInstanceFromWindow=t=>window.google;function useLoadGoogleCharts(t){const{chartVersion:e="current",chartPackages:n=["corechart","controls"],chartLanguage:o="en",mapsApiKey:l}=t,[d,f]=React.useState(null),[g,b]=React.useState(null),[_,S]=React.useState(null),{isLoading:R,error:C,isSuccess:E}=useLoadScript(t.chartLoaderScriptUrl||"https://www.gstatic.com/charts/loader.js");return React.useEffect(()=>{if(!E)return;const A=getGoogleInstanceFromWindow();if(!isGoogleReady(A)){const M=new Error("[ScriptInitializationError] Script loaded but Google not attached to window.");b(M);return}if(isGoogleChartsReady(t,A)){f(A);return}A.charts.load(e,{packages:n,language:o,mapsApiKey:l}),A.charts.setOnLoadCallback(()=>{if(!isGoogleChartsReady(t,A)){const M=new Error("[GoogleChartsInitializationError] Google Charts not ready after load callback.");console.error(M),S(M);return}f(A)})},[E]),{error:C||g||_,isLoading:R,google:d}}const chartDefaultProps={legend_toggle:!1,options:{},legendToggle:!1,getChartWrapper:()=>{},spreadSheetQueryParameters:{headers:1,gid:1},rootProps:{},chartWrapperParams:{},chartLoaderScriptUrl:"https://www.gstatic.com/charts/loader.js"},GoogleChartControls=t=>{const{isReady:e,chartControls:n,filter:o}=t;return!e||!n||!(n!=null&&n.length)?null:React.createElement(React.Fragment,null,n.filter(l=>{let{controlProp:d,control:f}=l;return o?o({control:f,controlProp:d}):!0}).map(l=>{let{control:d}=l;return React.createElement("div",{key:d.getContainerId(),id:d.getContainerId()})}))};let uniqueID=0;const generateUniqueID=()=>(uniqueID+=1,`reactgooglegraph-${uniqueID}`),Mr=class Mr{};Qt(Mr,"initializeControls",e=>{for(let n=0;n<e.length;n+=1){const{controlType:o,options:l,controlWrapperParams:d}=e[n].controlProp;d&&"state"in d&&e[n].control.setState(d.state),e[n].control.setOptions(l),e[n].control.setControlType(o)}}),Qt(Mr,"listenToControlEvents",(e,n)=>{const{google:o}=n;return e.flatMap(l=>{const{control:d,controlProp:f}=l,{controlEvents:g=[]}=f;return g.map(b=>{const{callback:_,eventName:S}=b;return o.visualization.events.addListener(d,S,function(){for(var R=arguments.length,C=new Array(R),E=0;E<R;E++)C[E]=arguments[E];_({chartWrapper:null,controlWrapper:d,props:n,google:o,eventArgs:C})})})})}),Qt(Mr,"createControlId",e=>{let n;return typeof e>"u"?n=`googlechart-control-${generateUniqueID()}`:n=e,n}),Qt(Mr,"createChartControls",e=>{const{controls:n,google:o}=e;return n?n.map((l,d)=>{const{controlID:f,controlType:g,options:b,controlWrapperParams:_}=l,S=Mr.createControlId(f);return{controlProp:l,control:new o.visualization.ControlWrapper({containerId:S,controlType:g,options:b,..._})}}):null}),Qt(Mr,"addControls",e=>{const{chartWrapper:n,chartDashboard:o}=e,l=Mr.createChartControls(e);return!l||!o||!n?null:(o.bind(l.map(d=>{let{control:f}=d;return f}),n),Mr.initializeControls(l),l)});let GoogleChartControlsInternal=Mr;const useCreateChartControls=t=>{const[e,n]=React__namespace.useState(null);return[React__namespace.useMemo(()=>!e||!t?null:t.map((l,d)=>{const f=e[d];return f?{controlProp:l,control:f}:void 0}).flatMap(l=>l?[l]:[]),[e,t]),n]},useListenToControlEvents=(t,e)=>{React__namespace.useEffect(()=>{const n=GoogleChartControlsInternal.listenToControlEvents(t??[],e);return()=>{n.forEach(o=>{e.google.visualization.events.removeListener(o)})}},[t,e])},useChartControls=t=>{const[e,n]=useCreateChartControls(t.controls);return useListenToControlEvents(e??[],t),{addControls:l=>{const d=GoogleChartControlsInternal.addControls(l);n((d==null?void 0:d.map(f=>f.control))??null)},renderControl:l=>{const{chartWrapper:d,chartDashboard:f}=t;return React__namespace.createElement(GoogleChartControls,{...t,isReady:!!(d&&f),chartControls:e,filter:l})}}},useChartId=t=>{const e=React__namespace.useRef(null);return{chartId:(()=>{const{graphID:l,graph_id:d}=t,f=l||d;let g;return f?g=f:g=e.current||generateUniqueID(),e.current=g,e.current})()}},DEFAULT_CHART_COLORS=["#3366CC","#DC3912","#FF9900","#109618","#990099","#3B3EAC","#0099C6","#DD4477","#66AA00","#B82E2E","#316395","#994499","#22AA99","#AAAA11","#6633CC","#E67300","#8B0707","#329262","#5574A6","#3B3EAC"],loadDataTableFromSpreadSheet=async function(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return new Promise((o,l)=>{const d=`${n.headers?`headers=${n.headers}`:"headers=0"}`,f=`${n.query?`&tq=${encodeURIComponent(n.query)}`:""}`,g=`${n.gid?`&gid=${n.gid}`:""}`,b=`${n.sheet?`&sheet=${n.sheet}`:""}`,_=`${n.access_token?`&access_token=${n.access_token}`:""}`,S=`${d}${g}${b}${f}${_}`,R=`${e}/gviz/tq?${S}`;new t.visualization.Query(R).send(E=>{E.isError()?l(`Error in query: ${E.getMessage()} ${E.getDetailedMessage()}`):o(E.getDataTable())})})},GRAY_COLOR="#CCCCCC",wr=class wr{};Qt(wr,"grayOutHiddenColumnsLabel",(e,n)=>{const{googleChartWrapper:o,options:l}=e;if(!o){console.error("googleChartWrapper is not defined");return}const d=o.getDataTable();if(!d)return;const f=d.getNumberOfColumns();if(n.length>0===!1)return;const b=Array.from({length:f-1}).map((_,S)=>{const R=wr.getColumnId(d,S+1);return n.includes(R)?GRAY_COLOR:l&&l.colors?l.colors[S]:DEFAULT_CHART_COLORS[S]});o.setOptions({...l,colors:b}),o.draw()}),Qt(wr,"listenToLegendToggle",(e,n)=>{const[o,l]=n,{google:d,googleChartWrapper:f}=e;if(!f){console.error("googleChartWrapper is not defined");return}return d.visualization.events.addListener(f,"select",()=>{const b=f.getChart().getSelection(),_=f.getDataTable();if(b.length===0||b[0].row!==null||!_)return;const S=b[0].column,R=wr.getColumnId(_,S);o!=null&&o.includes(R)?l(C=>[...C.filter(E=>E!==R)]):l(C=>[...C,R])})}),Qt(wr,"draw",async e=>{const{data:n,diffdata:o,rows:l,columns:d,options:f,chartType:g,formatters:b,spreadSheetUrl:_,spreadSheetQueryParameters:S,googleChartDashboard:R,googleChartWrapper:C,google:E,hiddenColumns:A,legendToggle:M,legend_toggle:I}=e;if(!C){console.error("draw was called with googleChartWrapper = null");return}let j,q=null;if(o){const te=E.visualization.arrayToDataTable(o.old),ne=E.visualization.arrayToDataTable(o.new);q=E.visualization[g].prototype.computeDiff(te,ne)}n?n instanceof E.visualization.DataTable?j=n:Array.isArray(n)?j=E.visualization.arrayToDataTable(n):j=new E.visualization.DataTable(n):l&&d?j=E.visualization.arrayToDataTable([d,...l]):_?j=await loadDataTableFromSpreadSheet(E,_,S):j=E.visualization.arrayToDataTable([]);const z=j.getNumberOfColumns(),Q=Array(z).fill(0).map((te,ne)=>{const se=wr.getColumnId(j,ne);return A.includes(se)?{label:j.getColumnLabel(ne),type:j.getColumnType(ne),calc:()=>null}:ne}),F=C.getChart();C.getChartType()==="Timeline"&&F&&F.clearChart(),C.setChartType(g),C.setOptions(f||{});const V=new E.visualization.DataView(j);V.setColumns(Q),C.setDataTable(V),C.draw(),R&&R.draw(j),q&&(C.setDataTable(q),C.draw()),b&&(wr.applyFormatters({dataTable:j,formatters:b,google:E}),C.setDataTable(j),C.draw()),(M===!0||I===!0)&&wr.grayOutHiddenColumnsLabel(e,A)}),Qt(wr,"getColumnId",(e,n)=>e.getColumnId(n)||e.getColumnLabel(n)),Qt(wr,"applyFormatters",e=>{let{dataTable:n,formatters:o,google:l}=e;for(let d of o)switch(d.type){case"ArrowFormat":{new l.visualization.ArrowFormat(d.options).format(n,d.column);return}case"BarFormat":{new l.visualization.BarFormat(d.options).format(n,d.column);return}case"ColorFormat":{const f=new l.visualization.ColorFormat(d.options),{ranges:g}=d;if(g)for(let b of g)f.addRange(...b);f.format(n,d.column);return}case"DateFormat":{new l.visualization.DateFormat(d.options).format(n,d.column);return}case"NumberFormat":{new l.visualization.NumberFormat(d.options).format(n,d.column);return}case"PatternFormat":{new l.visualization.PatternFormat(d.options).format(n,d.column);return}default:{console.warn(`Unknown formatter type: ${d.type}`);return}}});let GoogleChartInternal=wr;const useGoogleChartDataTable=t=>{const{google:e,googleChartWrapper:n,googleChartDashboard:o}=t,[l,d]=React__namespace.useState([]);React__namespace.useEffect(()=>{n&&GoogleChartInternal.draw({...t,hiddenColumns:l,googleChartWrapper:n,googleChartDashboard:o,google:e})},[l,t.data,t.rows,t.columns,t.options,t.chartLoaderScriptUrl,t.chartType,t.formatters,t.spreadSheetUrl,t.spreadSheetQueryParameters,t.legendToggle,t.legend_toggle]);const f=()=>{const{googleChartWrapper:_}=t;_&&_.draw()},g=_=>{const S=[],{legendToggle:R,legend_toggle:C}=t;if(GoogleChartInternal.draw({...t,hiddenColumns:l,googleChartWrapper:_,googleChartDashboard:o,google:e}),window.addEventListener("resize",f),C||R){const E=GoogleChartInternal.listenToLegendToggle(t,[l,d]);E&&S.push(E)}return S},b=(_,S)=>{window.removeEventListener("resize",f),S.forEach(R=>{e.visualization.events.removeListener(R)}),_.getChartType()==="Timeline"&&_.getChart()&&_.getChart().clearChart()};React__namespace.useEffect(()=>{if(!n)return;const _=g(n);return()=>{b(n,_)}},[n,g,b])},listenToEvents=t=>{const{chartEvents:e,google:n,googleChartWrapper:o}=t;if(e){if(!o){console.warn("listenToEvents was called before chart wrapper ready.");return}return e.map(l=>{let{eventName:d,callback:f}=l;return n.visualization.events.addListener(o,d,function(){for(var g=arguments.length,b=new Array(g),_=0;_<g;_++)b[_]=arguments[_];f({chartWrapper:o,props:t,google:n,eventArgs:b})})})}},useGoogleChartEvents=t=>{React.useEffect(()=>{if(!t.googleChartWrapper)return;const e=listenToEvents(t);return()=>{e==null||e.forEach(n=>{t.google.visualization.events.removeListener(n)})}},[t])},GoogleChart=t=>{const[e,n]=React__namespace.useState(null),[o,l]=React__namespace.useState(null),{addControls:d,renderControl:f}=useChartControls({...t,chartDashboard:o,chartWrapper:e});useGoogleChartEvents({...t,googleChartWrapper:e});const{chartId:g}=useChartId(t),b=React__namespace.useRef(null),_=React__namespace.useRef(null);React__namespace.useEffect(()=>{const{options:j,google:q,chartType:z,chartWrapperParams:Q,toolbarItems:F,getChartEditor:V,getChartWrapper:te,onLoad:ne}=t,se={chartType:z,options:j,containerId:g,...Q},ge=new q.visualization.ChartWrapper(se);ge.setOptions(j||{}),te==null||te(ge,q);const oe=new q.visualization.Dashboard(b.current);F&&q.visualization.drawToolbar(_.current,F);let Ae=null;V&&(Ae=new q.visualization.ChartEditor,V({chartEditor:Ae,chartWrapper:ge,google:q})),d({...t,chartDashboard:oe,chartWrapper:ge}),n(ge),l(oe),ne==null||ne(q,{google:q,chartWrapper:ge,chartEditor:Ae,chartDashboard:oe})},[]),useGoogleChartDataTable({...t,googleChartWrapper:e,googleChartDashboard:o});const S=()=>{const{width:j,height:q,options:z,style:Q,className:F,rootProps:V,google:te}=t,ne={height:q||z&&z.height,width:j||z&&z.width,...Q};return React__namespace.createElement("div",{id:g,style:ne,className:F,...V})},R=()=>t.toolbarItems?React__namespace.createElement("div",{ref:_}):null,{width:C,height:E,options:A,style:M}=t,I={height:E||A&&A.height,width:C||A&&A.width,...M};return t.render?React__namespace.createElement("div",{ref:b,style:I},React__namespace.createElement("div",{ref:_,id:"toolbar"}),t.render({renderChart:S,renderControl:f,renderToolbar:R})):React__namespace.createElement("div",{ref:b,style:I},f(j=>{let{controlProp:q}=j;return q.controlPosition!=="bottom"}),S(),f(j=>{let{controlProp:q}=j;return q.controlPosition==="bottom"}),R())},ChartContext=React__namespace.createContext(chartDefaultProps),ContextProvider=t=>{let{children:e,value:n}=t;return React__namespace.createElement(ChartContext.Provider,{value:n},e)},ChartView=t=>{const{google:e,isLoading:n,error:o}=useLoadGoogleCharts(t);return n?t.loader??null:o?t.errorElement??null:e?React.createElement(GoogleChart,{google:e,...t}):null},Chart=t=>{const e={...chartDefaultProps,...t};return React.createElement(ContextProvider,{value:e},React.createElement(ChartView,e))};var GoogleDataTableColumnRoleType;(function(t){t.annotation="annotation",t.annotationText="annotationText",t.certainty="certainty",t.emphasis="emphasis",t.interval="interval",t.scope="scope",t.style="style",t.tooltip="tooltip",t.domain="domain"})(GoogleDataTableColumnRoleType||(GoogleDataTableColumnRoleType={}));function parseHsl(t){const e=t.match(/(\d+\.?\d*)\s*(\d+\.?\d*)%\s*(\d+\.?\d*)%/);return e?{h:parseFloat(e[1]),s:parseFloat(e[2]),l:parseFloat(e[3])}:null}function hslToHex(t,e,n){n/=100;const o=e*Math.min(n,1-n)/100,l=d=>{const f=(d+t/30)%12,g=n-o*Math.max(Math.min(f-3,9-f,1),-1);return Math.round(255*g).toString(16).padStart(2,"0")};return`#${l(0)}${l(8)}${l(4)}`}const Treemap=React__namespace.forwardRef(({data:t,options:e,height:n="500px",className:o,loading:l,disableClick:d=!0,...f},g)=>{const b=React__namespace.useRef(null),[_,S]=React__namespace.useState(null);React__namespace.useEffect(()=>{if(!b.current)return;const E=b.current;let A;const M=()=>{const q=getComputedStyle(E).getPropertyValue("--primary").trim();if(q){const z=parseHsl(q);if(z){const{h:Q,s:F,l:V}=z;S({minColor:hslToHex(Q,F,Math.min(100,V+50)),midColor:hslToHex(Q,F,Math.min(100,V+35)),maxColor:hslToHex(Q,F,Math.min(100,V+20))})}return!0}return!1};if(M())return;let I=0;const j=20;return A=setInterval(()=>{(M()||I>=j)&&clearInterval(A),I++},100),()=>{A&&clearInterval(A)}},[]);const R=React__namespace.useMemo(()=>{const E={headerHeight:0,fontSize:14,showScale:!1,isHtml:!0,generateTooltip:(A,M)=>{var q;const I=(q=t[A+1])==null?void 0:q[0];if(!I)return"";const j=formatMoney(M);return`<div class="p-2 bg-background text-foreground border rounded-md shadow-lg">
1322
+ `;function RichTextEditor({id:t,name:e,value:n,onChange:o,placeholder:l,className:d,...f}){const[g,b]=React.useState(!1),_=React.useRef(null),S=React.useRef(null),R=useEditor({extensions:[StarterKit,Underline],content:n,editorProps:{attributes:{class:"prose prose-sm sm:prose dark:prose-invert focus:outline-none",id:t??"",name:e??""}},onUpdate:({editor:j})=>{const q=j.getHTML();o({target:{id:t,name:e,value:q}})}});React.useEffect(()=>{R&&n!==R.getHTML()&&R.commands.setContent(n)},[n,R]);const C=React.useCallback(j=>{if(R)if(R.chain().focus(),j==="paragraph")R.chain().setParagraph().run();else{const q=Number.parseInt(j.slice(1));R.chain().setHeading({level:q}).run()}},[R]),E=React.useCallback(j=>{if(R)switch(R.chain().focus(),j){case"bold":R.chain().toggleBold().run();break;case"italic":R.chain().toggleItalic().run();break;case"underline":R.chain().toggleUnderline().run();break;case"strike":R.chain().toggleStrike().run();break;case"bulletList":R.chain().toggleBulletList().run();break;case"orderedList":R.chain().toggleOrderedList().run();break}},[R]),A=React.useCallback(()=>{b(j=>!j)},[]),M=React.useCallback(j=>{const q=j.target.value;R&&R.commands.setContent(q),o({target:{id:t,name:e,value:q}})},[o,R,t,e]),I=React.useCallback(()=>{!g&&R&&R.commands.focus()},[g,R]);return R?jsxRuntime.jsxs("div",{ref:S,className:cn("border border-input rounded-md overflow-hidden focus-within:outline-hidden focus-within:ring-1 focus-within:ring-ring",d),onClick:I,...f,children:[jsxRuntime.jsx("style",{children:editorStyles}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center p-2 border-b border-input gap-2 bg-background",children:[jsxRuntime.jsxs(Select,{onValueChange:C,disabled:g,children:[jsxRuntime.jsx(SelectTrigger,{className:"w-[160px]",children:jsxRuntime.jsx(SelectValue,{placeholder:"Format"})}),jsxRuntime.jsx(SelectContent,{children:formatOptions.map(j=>jsxRuntime.jsx(SelectItem,{value:j.value,children:j.label},j.value))})]}),["bold","italic","underline","strike","bulletList","orderedList"].map(j=>jsxRuntime.jsxs(Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>E(j),className:R.isActive(j)?"bg-muted":"",disabled:g,children:[j==="bold"&&jsxRuntime.jsx(Bold$1,{className:"h-4 w-4"}),j==="italic"&&jsxRuntime.jsx(Italic$1,{className:"h-4 w-4"}),j==="underline"&&jsxRuntime.jsx(Underline$1,{className:"h-4 w-4"}),j==="strike"&&jsxRuntime.jsx(Strikethrough,{className:"h-4 w-4"}),j==="bulletList"&&jsxRuntime.jsx(List$1,{className:"h-4 w-4"}),j==="orderedList"&&jsxRuntime.jsx(ListOrdered,{className:"h-4 w-4"})]},j)),jsxRuntime.jsx(Button,{type:"button",variant:"ghost",size:"sm",onClick:A,className:g?"bg-muted":"",children:jsxRuntime.jsx(Code$1,{className:"h-4 w-4"})})]}),jsxRuntime.jsx("div",{className:"p-3",children:g?jsxRuntime.jsx(Textarea,{ref:_,id:t,name:e,value:R.getHTML(),onChange:M,className:cn("min-h-[150px] font-mono text-sm resize-none border-0 focus-visible:ring-0 focus-visible:ring-offset-0",d),placeholder:l}):jsxRuntime.jsx(EditorContent,{editor:R})})]}):null}function ReceiptsTable({receipts:t=null,loading:e=!1}){const n=React.useMemo(()=>[{accessorKey:"Location",header:"Location",cell:({row:d})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:d.original.Location??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"ReceiptDate",header:"Date",cell:({row:d})=>formatYYYYMMDDIntToDateString(d.original.ReceiptDate),enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:d})=>d.original.Quantity??"N/A",enableSorting:!0,enableFiltering:!0}],[]),o=React.useMemo(()=>{const d={};if(t){const f=Array.from(new Set(t.map(b=>b.Location).filter(b=>b!=null)));d.Location=f;const g=Array.from(new Set(t.map(b=>formatYYYYMMDDIntToDateString(b.ReceiptDate)).filter(b=>b!=="N/A"&&b!=="Invalid Date"))).sort((b,_)=>new Date(_).getTime()-new Date(b).getTime());d.ReceiptDate=g}return d},[t]),l=t||[];return jsxRuntime.jsx(DataTable,{columns:n,data:l,uniqueValues:o,loading:e,tableClass:"bg-card text-card-foreground"})}const formatDate$1=t=>{if(!t)return"N/A";try{const e=new Date(t);return isNaN(e.getTime())?"Invalid Date":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return"Invalid Date"}},getStatusVariant=t=>{const e=(t==null?void 0:t.toLowerCase())||"";return e.includes("accepted")?"success":e.includes("error")||e.includes("rejected")?"destructive":"neutral"};function ReturnsTable({applicationId:t,returns:e=null,loading:n=!1}){const o=React.useMemo(()=>[{accessorKey:"ReturnNumber1",header:"RMA Number",cell:({row:f})=>{const g=f.original.ReturnNumber1||f.original.ReturnNumber;return g?jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:`/${t}/Return/${g}`,className:"font-medium text-primary hover:underline",children:g})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["View details for return ",g]})})]})}):"N/A"},enableSorting:!0,enableFiltering:!0},{accessorKey:"RequestDate",header:"Request Date",cell:({row:f})=>formatDate$1(f.original.RequestDate),enableSorting:!0},{accessorKey:"InvoiceNumber",header:"Invoice Number",cell:({row:f})=>{const g=f.original.InvoiceNumber;return g?jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:`/${t}/Document/${g}`,className:"text-blue-600 hover:underline dark:text-blue-400",children:g})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["View details for invoice ",g]})})]})}):"N/A"},enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:f})=>f.original.Quantity??"0",enableSorting:!0},{accessorKey:"ReasonForReturn",header:"Return Reason",cell:({row:f})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:f.original.ReasonForReturn??"—"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"Status",header:"Status",cell:({row:f})=>{const g=f.original.Status,b=getStatusVariant(g);let _="border-gray-400 bg-gray-100 text-gray-600 dark:border-gray-600 dark:bg-gray-800/50 dark:text-gray-400";return b==="success"?_="border-green-500 bg-green-100 text-green-700 dark:border-green-600 dark:bg-green-900/50 dark:text-green-400":b==="destructive"&&(_="border-red-500 bg-red-100 text-red-700 dark:border-red-600 dark:bg-red-900/50 dark:text-red-400"),g?jsxRuntime.jsx(Badge,{variant:"outline",className:`${_} font-medium`,children:g}):"—"},enableSorting:!0,enableFiltering:!0},{accessorKey:"WarehouseLocation",header:"Warehouse",cell:({row:f})=>f.original.WarehouseLocation??"—",enableSorting:!0,enableFiltering:!0},{accessorKey:"LastUpdatedDate",header:"Last Update",cell:({row:f})=>formatDate$1(f.original.LastUpdatedDate)!=="N/A"?formatDate$1(f.original.LastUpdatedDate):"—",enableSorting:!0}],[t]),l=React.useMemo(()=>{const f={};if(e){const g=Array.from(new Set(e.map(S=>S.Status).filter(Boolean)));f.Status=g;const b=Array.from(new Set(e.map(S=>S.ReasonForReturn).filter(Boolean)));f.ReasonForReturn=b;const _=Array.from(new Set(e.map(S=>S.WarehouseLocation).filter(Boolean)));f.WarehouseLocation=_}return f},[e]),d=React.useMemo(()=>e?[...e].sort((g,b)=>(b.ReturnNumber1||b.ReturnNumber||"").localeCompare(g.ReturnNumber1||g.ReturnNumber||"")):[],[e]);return n?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-48"})}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-48 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Returns"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:o,data:d,uniqueValues:l})})]})}function InvoicesTable({applicationId:t,invoices:e=null,loading:n=!1}){const o=React.useMemo(()=>[{accessorKey:"InvoiceNumber",header:"Number",cell:({row:f})=>f.original.InvoiceNumber?jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:`/${t}/Document/${f.original.InvoiceNumber}`,className:"font-medium text-primary hover:underline",children:f.original.InvoiceNumber})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["View details for invoice ",f.original.InvoiceNumber]})})]})}):"—",enableSorting:!0,enableFiltering:!0},{accessorKey:"InvoiceDate",header:"Date",cell:({row:f})=>formatYYYYMMDDIntToDateString(f.original.InvoiceDate),enableSorting:!0,enableFiltering:!0},{accessorKey:"OrderNumber",header:"Order Number",cell:({row:f})=>f.original.OrderNumber?jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:`/${t}/GeneralDocument/${f.original.OrderNumber}`,className:"font-medium text-primary hover:underline",children:f.original.OrderNumber})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["View details for order ",f.original.OrderNumber]})})]})}):"—",enableSorting:!0,enableFiltering:!0},{accessorKey:"PONumber",header:"PO Number",cell:({row:f})=>f.original.PONumber&&f.original.PONumber.trim().length>0?f.original.PONumber:"—",enableSorting:!0,enableFiltering:!0},{accessorKey:"ShipToName",header:"Ship To Name",cell:({row:f})=>f.original.ShipToName??"—",enableSorting:!0,enableFiltering:!0},{accessorKey:"QuantityOrdered",header:"Quantity Ordered",cell:({row:f})=>f.original.QuantityOrdered??0,enableSorting:!0,enableFiltering:!0},{accessorKey:"UnitPrice",header:"Unit Price",cell:({row:f})=>formatMoney(f.original.UnitPrice??0),enableSorting:!0,enableFiltering:!0},{accessorKey:"Location",header:"Location",cell:({row:f})=>f.original.Location??"—",enableSorting:!0,enableFiltering:!0}],[t]),l=React.useMemo(()=>{const f={};if(e){const g=Array.from(new Set(e.map(C=>C.ShipToName).filter(C=>C!=null)));f.ShipToName=g;const b=Array.from(new Set(e.map(C=>C.InvoiceNumber).filter(C=>C!=null)));f.InvoiceNumber=b;const _=Array.from(new Set(e.map(C=>C.OrderNumber).filter(C=>C!=null)));f.OrderNumber=_;const S=Array.from(new Set(e.map(C=>C.PONumber).filter(C=>C!=null)));f.PONumber=S;const R=Array.from(new Set(e.map(C=>C.Location).filter(C=>C!=null)));f.Location=R}return f},[e]),d=e||[];return jsxRuntime.jsx(DataTable,{columns:o,data:d,uniqueValues:l,loading:n,tableClass:"bg-card text-card-foreground"})}function ProductOverviewPage({applicationId:t,sku:e,productDefaultOpportunityNumber:n="",productOnAddToCart:o,productAddingToCart:l=!1,productShopifyHostname:d,productCustomAction:f=jsxRuntime.jsx(jsxRuntime.Fragment,{})}){var I,j,q,z,Q,F,V,te,ne,se,ge,oe;const{data:g,isLoading:b}=useGetV4PartnerByRouteApplicationIdProductAndRandmarSkuQuery({routeApplicationId:t,randmarSku:e,withSpecification:!1},{skip:!t||!e}),{data:_,isLoading:S}=useGetV4PartnerByRouteApplicationIdProductAndRandmarSkuQuery({routeApplicationId:t,randmarSku:e,withSpecification:!0},{skip:!g}),[R,C]=React.useState("stats"),[E,A]=React.useState(!1);React.useEffect(()=>{var Ne,Oe,Fe,ze,$e,Be,qe,Ge;if(S||!_){A(!1);return}const Ae={stats:(((Ne=_==null?void 0:_.SalesStatistics)==null?void 0:Ne.length)??0)<=0,inventory:(((Fe=(Oe=_==null?void 0:_.Distribution)==null?void 0:Oe.Inventory)==null?void 0:Fe.length)??0)<=0,opportunities:(((ze=_==null?void 0:_.Opportunities)==null?void 0:ze.length)??0)<=0,orders:((($e=_==null?void 0:_.ActiveOrderDetails)==null?void 0:$e.length)??0)<=0&&(((Be=_==null?void 0:_.Returns)==null?void 0:Be.length)??0)<=0,invoices:(((qe=_==null?void 0:_.CompletedOrderDetails)==null?void 0:qe.length)??0)<=0,warehouse:(((Ge=_==null?void 0:_.Receipts)==null?void 0:Ge.length)??0)<=0},je=Object.values(Ae).some(He=>!He);if(A(je),je&&Ae[R]){const He=Object.keys(Ae).find(Ze=>!Ae[Ze]);He&&C(He)}},[S,_,R]);const M=(g==null?void 0:g.ManufacturerId)!==t;return console.log("readonly",M),jsxRuntime.jsxs("div",{className:"@container",children:[jsxRuntime.jsxs("div",{className:"grid gap-4 grid-cols-1 @sm:grid-cols-2 @md:grid-cols-3",children:[jsxRuntime.jsx("div",{className:"@md:col-span-2",children:jsxRuntime.jsx(ProductCard,{applicationId:t,product:_||g,defaultOpportunityNumber:n,onAddToCart:o,addingToCart:l,shopifyHostname:d,customAction:f})}),jsxRuntime.jsxs(Card,{className:"flex flex-col",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsxs(CardTitle,{children:[jsxRuntime.jsx(Info,{className:"h-5 w-5 inline mr-2"})," Additionnal information"]})}),jsxRuntime.jsx(CardContent,{className:"basis-0 mb-6 grow overflow-y-auto",children:b?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsx(Skeleton,{className:"h-1 w-full my-6"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full mt-2"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full mt-1"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Cateory Name"}),jsxRuntime.jsx("span",{className:"font-medium",children:(g==null?void 0:g.ProductType)||"N/A"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Master Carton"}),jsxRuntime.jsx("span",{className:"font-medium",children:(g==null?void 0:g.MasterCarton)||"N/A"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Skid Quantity"}),jsxRuntime.jsx("span",{className:"font-medium",children:(g==null?void 0:g.SkidQuantity)||"N/A"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Automatic Reorder"}),jsxRuntime.jsx("span",{className:"font-medium",children:g!=null&&g.AutoUpdate?"Yes":"No"})]}),((g==null?void 0:g.VoiceoverCaption)||(g==null?void 0:g.BodyHTML))&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("hr",{className:"my-6"}),jsxRuntime.jsx("div",{className:"text-muted-foreground mb-2",children:"Description"}),(g==null?void 0:g.VoiceoverCaption)&&jsxRuntime.jsx("div",{children:g==null?void 0:g.VoiceoverCaption}),(g==null?void 0:g.BodyHTML)&&jsxRuntime.jsx("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:(g==null?void 0:g.BodyHTML)??""}})]})]})})]})]}),jsxRuntime.jsx("div",{className:"my-4",children:b||S?jsxRuntime.jsx("div",{className:"mx-auto flex justify-center items-center h-32",children:jsxRuntime.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin text-primary"})}):E&&jsxRuntime.jsxs(Tabs,{value:R,onValueChange:C,children:[jsxRuntime.jsxs(TabsList,{className:"inline-flex h-auto items-center justify-center rounded-none border-b bg-transparent p-0",children:[jsxRuntime.jsx(TabsTrigger,{value:"stats",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",disabled:(((I=_==null?void 0:_.SalesStatistics)==null?void 0:I.length)??0)<=0,children:"Statistics"}),jsxRuntime.jsx(TabsTrigger,{value:"inventory",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",disabled:(((q=(j=_==null?void 0:_.Distribution)==null?void 0:j.Inventory)==null?void 0:q.length)??0)<=0,children:"Inventory"}),jsxRuntime.jsx(TabsTrigger,{value:"opportunities",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",disabled:(((z=_==null?void 0:_.Opportunities)==null?void 0:z.length)??0)<=0,children:"Opportunities"}),jsxRuntime.jsx(TabsTrigger,{value:"orders",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",disabled:(((Q=_==null?void 0:_.ActiveOrderDetails)==null?void 0:Q.length)??0)<=0&&(((F=_==null?void 0:_.Returns)==null?void 0:F.length)??0)<=0,children:"Orders"}),jsxRuntime.jsx(TabsTrigger,{value:"invoices",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",disabled:(((V=_==null?void 0:_.Invoices)==null?void 0:V.length)??0)<=0,children:"Invoices"}),jsxRuntime.jsx(TabsTrigger,{value:"warehouse",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",disabled:(((te=_==null?void 0:_.Receipts)==null?void 0:te.length)??0)<=0,children:"Latest Warehouse Receiving"})]}),jsxRuntime.jsx(TabsContent,{value:"stats",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(SalesChartCard,{statistics:(_==null?void 0:_.SalesStatistics)??[],loading:S})})}),jsxRuntime.jsx(TabsContent,{value:"inventory",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ProductInventoryGrid,{inventory:((ne=_==null?void 0:_.Distribution)==null?void 0:ne.Inventory)??[],className:"bg-card text-card-foreground"})})}),jsxRuntime.jsx(TabsContent,{value:"opportunities",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(OpportunitiesTable,{applicationId:t,opportunities:g==null?void 0:g.Opportunities,loading:b})})}),jsxRuntime.jsxs(TabsContent,{value:"orders",children:[(((se=_==null?void 0:_.ActiveOrderDetails)==null?void 0:se.length)??0)>0&&jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(OrdersCard,{applicationId:t,title:"Open Orders",orders:_==null?void 0:_.ActiveOrderDetails,loading:S})}),(((ge=_==null?void 0:_.Returns)==null?void 0:ge.length)??0)>0&&jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ReturnsTable,{applicationId:t,returns:_==null?void 0:_.Returns,loading:S})})]}),jsxRuntime.jsx(TabsContent,{value:"invoices",children:(((oe=_==null?void 0:_.Invoices)==null?void 0:oe.length)??0)>0&&jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(InvoicesTable,{applicationId:t,invoices:_==null?void 0:_.Invoices,loading:S})})}),jsxRuntime.jsx(TabsContent,{value:"warehouse",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ReceiptsTable,{receipts:_==null?void 0:_.Receipts,loading:S})})})]})})]})}function AssistantChat(t){return jsxRuntime.jsx(Card,{className:"max-w-6xl",children:jsxRuntime.jsx(ChatLayout,{className:"h-[40em]",userId:t.userId,userName:t.userName,assistantOnly:!0,initialPrompt:t.initialPrompt})})}function getEndDateStatus(t){if(!t)return{text:"No End Date",variant:"neutral",daysRemaining:null};const e=new Date(t);if(isNaN(e.getTime()))return{text:"Invalid Date",variant:"neutral",daysRemaining:null};const n=new Date,o=new Date(e.getFullYear(),e.getMonth(),e.getDate()),l=new Date(n.getFullYear(),n.getMonth(),n.getDate()),d=o.getTime()-l.getTime(),f=Math.ceil(d/(1e3*60*60*24));return f<0?{text:`Ended ${Math.abs(f)}d ago`,variant:"destructive",daysRemaining:f}:f===0?{text:"Ends today",variant:"destructive",daysRemaining:f}:f<=7?{text:`Ends in ${f}d`,variant:"destructive",daysRemaining:f}:f<=30?{text:`Ends in ${f}d`,variant:"warning",daysRemaining:f}:{text:`Ends in ${f}d`,variant:"neutral",daysRemaining:f}}const formatDate=t=>{if(!t)return"N/A";try{const e=new Date(t);return isNaN(e.getTime())?"Invalid Date":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return"Invalid Date"}};function OpportunitiesTable({applicationId:t,opportunities:e=null,loading:n=!1}){var te;const{toast:o}=useToast(),[l,d]=React.useState({}),[f,g]=React.useState(!1),[b,_]=React.useState(""),[S,R]=React.useState(null),{data:C}=useGetV4PartnerByApplicationIdAccountQuery({applicationId:t},{skip:!t}),E=React.useCallback((ne,se,ge)=>{d(oe=>({...oe,[ne]:{...oe[ne],[se]:ge}}))},[]),[A]=usePutV4ResellerByRouteResellerIdOpportunityAndManufacturerIdDefaultMutation(),M=React.useCallback(async ne=>{if(!(C!=null&&C.IsReseller))return;if(!ne.BidNumber){o({title:"Error",description:"Bid Number is missing, cannot set default.",variant:"destructive"});return}const se=ne.BidNumber;E(se,"isSettingDefault",!0),A({routeResellerId:t,manufacturerId:ne.ManufacturerId??"",opportunityNumber:se}).unwrap().then(()=>{o({title:"Success",description:`Opportunity "${ne.OpportunityName||ne.Opportunity||se}" was successfully set as default.`,variant:"success"})}).catch(ge=>{var oe;console.error("Set as default error:",ge),o({title:"Error",description:((oe=ge.data)==null?void 0:oe.message)||ge.message||"An error occurred while setting this opportunity as default.",variant:"destructive"})}).finally(()=>{E(se,"isSettingDefault",!1)})},[t,A,o,E]),[I]=usePostV4ResellerByRouteResellerIdOpportunityAndManufacturerIdBidNumberEmailMutation(),j=React.useCallback(ne=>{if(C!=null&&C.IsReseller){if(!ne.BidNumber){o({title:"Error",description:"Bid Number is missing, cannot prepare report.",variant:"destructive"});return}R(ne),_(""),g(!0)}},[o]),q=React.useCallback(async()=>{if(!(C!=null&&C.IsReseller))return;if(!S||!S.BidNumber){o({title:"Error",description:"No opportunity selected or Bid Number is missing.",variant:"destructive"});return}if(!b.trim()||!/\S+@\S+\.\S+/.test(b)){o({title:"Validation Error",description:"Please enter a valid email address.",variant:"destructive"});return}const ne=S.BidNumber;E(ne,"isSendingReport",!0),I({routeResellerId:t,manufacturerId:S.ManufacturerId??"",bidNumber:ne,emailAddress:b}).unwrap().then(()=>{o({title:"Success",description:`A report for "${S.OpportunityName||S.Opportunity||ne}" was successfully sent to ${b}.`,variant:"success"}),g(!1)}).catch(se=>{var ge;console.error("Send report by email error:",se),o({title:"Error",description:((ge=se.data)==null?void 0:ge.message)||se.message||"An error occurred while sending the report by email.",variant:"destructive"})}).finally(()=>{E(ne,"isSendingReport",!1),f||(R(null),_(""))})},[S,b,t,I,o,E,g]),z=React.useMemo(()=>[{accessorKey:"ManufacturerId",header:"Manuf.",cell:({row:ne})=>jsxRuntime.jsx("div",{className:"w-20 h-8",children:jsxRuntime.jsx(PartnerLogo,{id:ne.original.ManufacturerId,width:80,height:32})}),enableSorting:!0,enableFiltering:!0},{id:"opportunityDisplay",accessorFn:ne=>ne.OpportunityName||ne.Opportunity,header:"Opportunity",cell:({getValue:ne})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:ne()??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"BidNumber",header:"Bid Number",cell:({row:ne})=>ne.original.BidNumber??"N/A",enableSorting:!0,enableFiltering:!0},{id:"statusInfo",header:"Status",cell:({row:ne})=>{const se=ne.original,ge=se.Active===!0,oe=getEndDateStatus(se.EndDate);let Ae="border-gray-400 bg-gray-100 text-gray-600 dark:border-gray-600 dark:bg-gray-800/50 dark:text-gray-400";return oe.variant==="destructive"?Ae="border-red-500 bg-red-100 text-red-700 dark:border-red-600 dark:bg-red-900/50 dark:text-red-400":oe.variant==="warning"&&(Ae="border-yellow-500 bg-yellow-100 text-yellow-700 dark:border-yellow-600 dark:bg-yellow-900/50 dark:text-yellow-400"),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 min-w-[200px]",children:[jsxRuntime.jsx(Badge,{variant:"outline",className:ge?"border-green-500 bg-green-100 text-green-700 dark:border-green-600 dark:bg-green-900/50 dark:text-green-400 font-medium":"border-gray-400 bg-gray-100 text-gray-600 dark:border-gray-600 dark:bg-gray-800/50 dark:text-gray-400 font-medium",children:ge?"Active":"Inactive"}),se.EndDate&&jsxRuntime.jsx(Badge,{variant:"outline",className:`${Ae} font-medium`,children:oe.text}),jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"h-6 w-6 p-0 data-[state=delayed-open]:bg-accent data-[state=instant-open]:bg-accent",children:jsxRuntime.jsx(Info,{className:"h-4 w-4 text-muted-foreground"})})}),jsxRuntime.jsx(TooltipContent,{side:"top",align:"center",className:"bg-popover text-popover-foreground p-2 rounded shadow-lg",children:jsxRuntime.jsxs("div",{className:"text-sm space-y-1",children:[jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"Start:"})," ",formatDate(se.StartDate)]}),jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"End:"})," ",formatDate(se.EndDate)]}),jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"Updated:"})," ",formatDate(se.LastUpdate)]})]})})]})})]})},enableFiltering:!1},{id:"actions",header:"Actions",cell:({row:ne})=>{var Oe,Fe;const se=ne.original;if(!se.BidNumber)return jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"Actions unavailable"});const ge=se.BidNumber,oe=(Oe=l[ge])==null?void 0:Oe.isSettingDefault,Ae=(S==null?void 0:S.BidNumber)===ge&&((Fe=l[ge])==null?void 0:Fe.isSendingReport),je=oe||Ae,Ne=se.CanBeSetAsDefault===!0;return jsxRuntime.jsxs("div",{className:"flex space-x-2",children:[jsxRuntime.jsx(reactRouterDom.Link,{to:`/${t}/Opportunity/${se.ManufacturerId}/${se.BidNumber}`,children:jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",className:"flex items-center",children:[jsxRuntime.jsx(Star,{className:"mr-2 h-4 w-4"})," View"]})}),(C==null?void 0:C.IsReseller)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",onClick:()=>M(se),disabled:je||!Ne,title:Ne?"Set as default":"This opportunity cannot be set as default",className:"flex items-center",children:[oe?jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}):jsxRuntime.jsx(Star,{className:"mr-2 h-4 w-4"})," Set Default"]}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",onClick:()=>j(se),disabled:je,title:"Send report by email",className:"flex items-center",children:[Ae?jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}):jsxRuntime.jsx(Send,{className:"mr-2 h-4 w-4"})," Send Report"]})]})]})}}],[l,M,j,S]),Q=React.useMemo(()=>{const ne={};if(e){const se=Array.from(new Set(e.map(oe=>oe.ManufacturerId).filter(oe=>oe!=null)));ne.ManufacturerId=se;const ge=Array.from(new Set(e.map(oe=>oe.OpportunityName||oe.Opportunity).filter(oe=>oe!=null)));ne.opportunityDisplay=ge}return ne},[e]),F=e||[],V=S!=null&&S.BidNumber?(te=l[S.BidNumber])==null?void 0:te.isSendingReport:!1;return n?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-48"})," "]}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-48 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"})," ",jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"})," ",jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})," ",jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Opportunities"})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:z,data:F,uniqueValues:Q})})]}),jsxRuntime.jsx(Dialog,{open:f,onOpenChange:ne=>{g(ne),ne||(R(null),_(""))},children:jsxRuntime.jsxs(DialogContent,{className:"@sm:max-w-[425px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Send Opportunity Report"}),jsxRuntime.jsxs(DialogDescription,{children:["Enter the email address to send the report for opportunity: ",jsxRuntime.jsx("br",{}),jsxRuntime.jsx("span",{className:"font-semibold",children:(S==null?void 0:S.OpportunityName)||(S==null?void 0:S.Opportunity)||"N/A"}),(S==null?void 0:S.BidNumber)&&jsxRuntime.jsxs("span",{className:"block text-sm text-muted-foreground",children:["Bid Number: ",S.BidNumber]})]})]}),jsxRuntime.jsx("div",{className:"grid gap-4 py-4",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",className:"text-right",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",type:"email",value:b,onChange:ne=>_(ne.target.value),placeholder:"recipient@example.com",className:"col-span-3",disabled:V})]})}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>g(!1),disabled:V,children:"Cancel"}),jsxRuntime.jsxs(Button,{type:"submit",onClick:q,disabled:V,children:[V&&jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"})," Send Report"]})]})]})})]})}function useLoadScript(t){const[e,n]=React.useState(!0),[o,l]=React.useState(null),[d,f]=React.useState(!1),g=()=>{n(!1),f(!0)};return React.useEffect(()=>{if(!document){const R=new Error(`[ScriptLoadingError] document not defined when attempting to load ${t}`);l(R);return}const b=document.querySelector(`script[src="${t}"]`);if(b!=null&&b.dataset.loaded){g();return}const _=b||document.createElement("script");b||(_.src=t);const S=()=>{_.dataset.loaded="1",g()};_.addEventListener("load",S),_.addEventListener("error",R=>{console.error("Failed to load script:",t,R);const C=new Error(`[ScriptLoadingError] Failed to load script: ${t}`);l(C)}),b||document.head.append(_)},[]),{isLoading:e,error:o,isSuccess:d}}const isGoogleReady=t=>t&&t.charts,isGoogleChartsReady=(t,e)=>{const{controls:n,toolbarItems:o,getChartEditor:l}=t;return e&&e.charts&&e.visualization&&e.visualization.ChartWrapper&&e.visualization.Dashboard&&(!n||e.visualization.ChartWrapper)&&(!l||e.visualization.ChartEditor)&&(!o||e.visualization.drawToolbar)},getGoogleInstanceFromWindow=t=>window.google;function useLoadGoogleCharts(t){const{chartVersion:e="current",chartPackages:n=["corechart","controls"],chartLanguage:o="en",mapsApiKey:l}=t,[d,f]=React.useState(null),[g,b]=React.useState(null),[_,S]=React.useState(null),{isLoading:R,error:C,isSuccess:E}=useLoadScript(t.chartLoaderScriptUrl||"https://www.gstatic.com/charts/loader.js");return React.useEffect(()=>{if(!E)return;const A=getGoogleInstanceFromWindow();if(!isGoogleReady(A)){const M=new Error("[ScriptInitializationError] Script loaded but Google not attached to window.");b(M);return}if(isGoogleChartsReady(t,A)){f(A);return}A.charts.load(e,{packages:n,language:o,mapsApiKey:l}),A.charts.setOnLoadCallback(()=>{if(!isGoogleChartsReady(t,A)){const M=new Error("[GoogleChartsInitializationError] Google Charts not ready after load callback.");console.error(M),S(M);return}f(A)})},[E]),{error:C||g||_,isLoading:R,google:d}}const chartDefaultProps={legend_toggle:!1,options:{},legendToggle:!1,getChartWrapper:()=>{},spreadSheetQueryParameters:{headers:1,gid:1},rootProps:{},chartWrapperParams:{},chartLoaderScriptUrl:"https://www.gstatic.com/charts/loader.js"},GoogleChartControls=t=>{const{isReady:e,chartControls:n,filter:o}=t;return!e||!n||!(n!=null&&n.length)?null:React.createElement(React.Fragment,null,n.filter(l=>{let{controlProp:d,control:f}=l;return o?o({control:f,controlProp:d}):!0}).map(l=>{let{control:d}=l;return React.createElement("div",{key:d.getContainerId(),id:d.getContainerId()})}))};let uniqueID=0;const generateUniqueID=()=>(uniqueID+=1,`reactgooglegraph-${uniqueID}`),Mr=class Mr{};Qt(Mr,"initializeControls",e=>{for(let n=0;n<e.length;n+=1){const{controlType:o,options:l,controlWrapperParams:d}=e[n].controlProp;d&&"state"in d&&e[n].control.setState(d.state),e[n].control.setOptions(l),e[n].control.setControlType(o)}}),Qt(Mr,"listenToControlEvents",(e,n)=>{const{google:o}=n;return e.flatMap(l=>{const{control:d,controlProp:f}=l,{controlEvents:g=[]}=f;return g.map(b=>{const{callback:_,eventName:S}=b;return o.visualization.events.addListener(d,S,function(){for(var R=arguments.length,C=new Array(R),E=0;E<R;E++)C[E]=arguments[E];_({chartWrapper:null,controlWrapper:d,props:n,google:o,eventArgs:C})})})})}),Qt(Mr,"createControlId",e=>{let n;return typeof e>"u"?n=`googlechart-control-${generateUniqueID()}`:n=e,n}),Qt(Mr,"createChartControls",e=>{const{controls:n,google:o}=e;return n?n.map((l,d)=>{const{controlID:f,controlType:g,options:b,controlWrapperParams:_}=l,S=Mr.createControlId(f);return{controlProp:l,control:new o.visualization.ControlWrapper({containerId:S,controlType:g,options:b,..._})}}):null}),Qt(Mr,"addControls",e=>{const{chartWrapper:n,chartDashboard:o}=e,l=Mr.createChartControls(e);return!l||!o||!n?null:(o.bind(l.map(d=>{let{control:f}=d;return f}),n),Mr.initializeControls(l),l)});let GoogleChartControlsInternal=Mr;const useCreateChartControls=t=>{const[e,n]=React__namespace.useState(null);return[React__namespace.useMemo(()=>!e||!t?null:t.map((l,d)=>{const f=e[d];return f?{controlProp:l,control:f}:void 0}).flatMap(l=>l?[l]:[]),[e,t]),n]},useListenToControlEvents=(t,e)=>{React__namespace.useEffect(()=>{const n=GoogleChartControlsInternal.listenToControlEvents(t??[],e);return()=>{n.forEach(o=>{e.google.visualization.events.removeListener(o)})}},[t,e])},useChartControls=t=>{const[e,n]=useCreateChartControls(t.controls);return useListenToControlEvents(e??[],t),{addControls:l=>{const d=GoogleChartControlsInternal.addControls(l);n((d==null?void 0:d.map(f=>f.control))??null)},renderControl:l=>{const{chartWrapper:d,chartDashboard:f}=t;return React__namespace.createElement(GoogleChartControls,{...t,isReady:!!(d&&f),chartControls:e,filter:l})}}},useChartId=t=>{const e=React__namespace.useRef(null);return{chartId:(()=>{const{graphID:l,graph_id:d}=t,f=l||d;let g;return f?g=f:g=e.current||generateUniqueID(),e.current=g,e.current})()}},DEFAULT_CHART_COLORS=["#3366CC","#DC3912","#FF9900","#109618","#990099","#3B3EAC","#0099C6","#DD4477","#66AA00","#B82E2E","#316395","#994499","#22AA99","#AAAA11","#6633CC","#E67300","#8B0707","#329262","#5574A6","#3B3EAC"],loadDataTableFromSpreadSheet=async function(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return new Promise((o,l)=>{const d=`${n.headers?`headers=${n.headers}`:"headers=0"}`,f=`${n.query?`&tq=${encodeURIComponent(n.query)}`:""}`,g=`${n.gid?`&gid=${n.gid}`:""}`,b=`${n.sheet?`&sheet=${n.sheet}`:""}`,_=`${n.access_token?`&access_token=${n.access_token}`:""}`,S=`${d}${g}${b}${f}${_}`,R=`${e}/gviz/tq?${S}`;new t.visualization.Query(R).send(E=>{E.isError()?l(`Error in query: ${E.getMessage()} ${E.getDetailedMessage()}`):o(E.getDataTable())})})},GRAY_COLOR="#CCCCCC",wr=class wr{};Qt(wr,"grayOutHiddenColumnsLabel",(e,n)=>{const{googleChartWrapper:o,options:l}=e;if(!o){console.error("googleChartWrapper is not defined");return}const d=o.getDataTable();if(!d)return;const f=d.getNumberOfColumns();if(n.length>0===!1)return;const b=Array.from({length:f-1}).map((_,S)=>{const R=wr.getColumnId(d,S+1);return n.includes(R)?GRAY_COLOR:l&&l.colors?l.colors[S]:DEFAULT_CHART_COLORS[S]});o.setOptions({...l,colors:b}),o.draw()}),Qt(wr,"listenToLegendToggle",(e,n)=>{const[o,l]=n,{google:d,googleChartWrapper:f}=e;if(!f){console.error("googleChartWrapper is not defined");return}return d.visualization.events.addListener(f,"select",()=>{const b=f.getChart().getSelection(),_=f.getDataTable();if(b.length===0||b[0].row!==null||!_)return;const S=b[0].column,R=wr.getColumnId(_,S);o!=null&&o.includes(R)?l(C=>[...C.filter(E=>E!==R)]):l(C=>[...C,R])})}),Qt(wr,"draw",async e=>{const{data:n,diffdata:o,rows:l,columns:d,options:f,chartType:g,formatters:b,spreadSheetUrl:_,spreadSheetQueryParameters:S,googleChartDashboard:R,googleChartWrapper:C,google:E,hiddenColumns:A,legendToggle:M,legend_toggle:I}=e;if(!C){console.error("draw was called with googleChartWrapper = null");return}let j,q=null;if(o){const te=E.visualization.arrayToDataTable(o.old),ne=E.visualization.arrayToDataTable(o.new);q=E.visualization[g].prototype.computeDiff(te,ne)}n?n instanceof E.visualization.DataTable?j=n:Array.isArray(n)?j=E.visualization.arrayToDataTable(n):j=new E.visualization.DataTable(n):l&&d?j=E.visualization.arrayToDataTable([d,...l]):_?j=await loadDataTableFromSpreadSheet(E,_,S):j=E.visualization.arrayToDataTable([]);const z=j.getNumberOfColumns(),Q=Array(z).fill(0).map((te,ne)=>{const se=wr.getColumnId(j,ne);return A.includes(se)?{label:j.getColumnLabel(ne),type:j.getColumnType(ne),calc:()=>null}:ne}),F=C.getChart();C.getChartType()==="Timeline"&&F&&F.clearChart(),C.setChartType(g),C.setOptions(f||{});const V=new E.visualization.DataView(j);V.setColumns(Q),C.setDataTable(V),C.draw(),R&&R.draw(j),q&&(C.setDataTable(q),C.draw()),b&&(wr.applyFormatters({dataTable:j,formatters:b,google:E}),C.setDataTable(j),C.draw()),(M===!0||I===!0)&&wr.grayOutHiddenColumnsLabel(e,A)}),Qt(wr,"getColumnId",(e,n)=>e.getColumnId(n)||e.getColumnLabel(n)),Qt(wr,"applyFormatters",e=>{let{dataTable:n,formatters:o,google:l}=e;for(let d of o)switch(d.type){case"ArrowFormat":{new l.visualization.ArrowFormat(d.options).format(n,d.column);return}case"BarFormat":{new l.visualization.BarFormat(d.options).format(n,d.column);return}case"ColorFormat":{const f=new l.visualization.ColorFormat(d.options),{ranges:g}=d;if(g)for(let b of g)f.addRange(...b);f.format(n,d.column);return}case"DateFormat":{new l.visualization.DateFormat(d.options).format(n,d.column);return}case"NumberFormat":{new l.visualization.NumberFormat(d.options).format(n,d.column);return}case"PatternFormat":{new l.visualization.PatternFormat(d.options).format(n,d.column);return}default:{console.warn(`Unknown formatter type: ${d.type}`);return}}});let GoogleChartInternal=wr;const useGoogleChartDataTable=t=>{const{google:e,googleChartWrapper:n,googleChartDashboard:o}=t,[l,d]=React__namespace.useState([]);React__namespace.useEffect(()=>{n&&GoogleChartInternal.draw({...t,hiddenColumns:l,googleChartWrapper:n,googleChartDashboard:o,google:e})},[l,t.data,t.rows,t.columns,t.options,t.chartLoaderScriptUrl,t.chartType,t.formatters,t.spreadSheetUrl,t.spreadSheetQueryParameters,t.legendToggle,t.legend_toggle]);const f=()=>{const{googleChartWrapper:_}=t;_&&_.draw()},g=_=>{const S=[],{legendToggle:R,legend_toggle:C}=t;if(GoogleChartInternal.draw({...t,hiddenColumns:l,googleChartWrapper:_,googleChartDashboard:o,google:e}),window.addEventListener("resize",f),C||R){const E=GoogleChartInternal.listenToLegendToggle(t,[l,d]);E&&S.push(E)}return S},b=(_,S)=>{window.removeEventListener("resize",f),S.forEach(R=>{e.visualization.events.removeListener(R)}),_.getChartType()==="Timeline"&&_.getChart()&&_.getChart().clearChart()};React__namespace.useEffect(()=>{if(!n)return;const _=g(n);return()=>{b(n,_)}},[n,g,b])},listenToEvents=t=>{const{chartEvents:e,google:n,googleChartWrapper:o}=t;if(e){if(!o){console.warn("listenToEvents was called before chart wrapper ready.");return}return e.map(l=>{let{eventName:d,callback:f}=l;return n.visualization.events.addListener(o,d,function(){for(var g=arguments.length,b=new Array(g),_=0;_<g;_++)b[_]=arguments[_];f({chartWrapper:o,props:t,google:n,eventArgs:b})})})}},useGoogleChartEvents=t=>{React.useEffect(()=>{if(!t.googleChartWrapper)return;const e=listenToEvents(t);return()=>{e==null||e.forEach(n=>{t.google.visualization.events.removeListener(n)})}},[t])},GoogleChart=t=>{const[e,n]=React__namespace.useState(null),[o,l]=React__namespace.useState(null),{addControls:d,renderControl:f}=useChartControls({...t,chartDashboard:o,chartWrapper:e});useGoogleChartEvents({...t,googleChartWrapper:e});const{chartId:g}=useChartId(t),b=React__namespace.useRef(null),_=React__namespace.useRef(null);React__namespace.useEffect(()=>{const{options:j,google:q,chartType:z,chartWrapperParams:Q,toolbarItems:F,getChartEditor:V,getChartWrapper:te,onLoad:ne}=t,se={chartType:z,options:j,containerId:g,...Q},ge=new q.visualization.ChartWrapper(se);ge.setOptions(j||{}),te==null||te(ge,q);const oe=new q.visualization.Dashboard(b.current);F&&q.visualization.drawToolbar(_.current,F);let Ae=null;V&&(Ae=new q.visualization.ChartEditor,V({chartEditor:Ae,chartWrapper:ge,google:q})),d({...t,chartDashboard:oe,chartWrapper:ge}),n(ge),l(oe),ne==null||ne(q,{google:q,chartWrapper:ge,chartEditor:Ae,chartDashboard:oe})},[]),useGoogleChartDataTable({...t,googleChartWrapper:e,googleChartDashboard:o});const S=()=>{const{width:j,height:q,options:z,style:Q,className:F,rootProps:V,google:te}=t,ne={height:q||z&&z.height,width:j||z&&z.width,...Q};return React__namespace.createElement("div",{id:g,style:ne,className:F,...V})},R=()=>t.toolbarItems?React__namespace.createElement("div",{ref:_}):null,{width:C,height:E,options:A,style:M}=t,I={height:E||A&&A.height,width:C||A&&A.width,...M};return t.render?React__namespace.createElement("div",{ref:b,style:I},React__namespace.createElement("div",{ref:_,id:"toolbar"}),t.render({renderChart:S,renderControl:f,renderToolbar:R})):React__namespace.createElement("div",{ref:b,style:I},f(j=>{let{controlProp:q}=j;return q.controlPosition!=="bottom"}),S(),f(j=>{let{controlProp:q}=j;return q.controlPosition==="bottom"}),R())},ChartContext=React__namespace.createContext(chartDefaultProps),ContextProvider=t=>{let{children:e,value:n}=t;return React__namespace.createElement(ChartContext.Provider,{value:n},e)},ChartView=t=>{const{google:e,isLoading:n,error:o}=useLoadGoogleCharts(t);return n?t.loader??null:o?t.errorElement??null:e?React.createElement(GoogleChart,{google:e,...t}):null},Chart=t=>{const e={...chartDefaultProps,...t};return React.createElement(ContextProvider,{value:e},React.createElement(ChartView,e))};var GoogleDataTableColumnRoleType;(function(t){t.annotation="annotation",t.annotationText="annotationText",t.certainty="certainty",t.emphasis="emphasis",t.interval="interval",t.scope="scope",t.style="style",t.tooltip="tooltip",t.domain="domain"})(GoogleDataTableColumnRoleType||(GoogleDataTableColumnRoleType={}));function parseHsl(t){const e=t.match(/(\d+\.?\d*)\s*(\d+\.?\d*)%\s*(\d+\.?\d*)%/);return e?{h:parseFloat(e[1]),s:parseFloat(e[2]),l:parseFloat(e[3])}:null}function hslToHex(t,e,n){n/=100;const o=e*Math.min(n,1-n)/100,l=d=>{const f=(d+t/30)%12,g=n-o*Math.max(Math.min(f-3,9-f,1),-1);return Math.round(255*g).toString(16).padStart(2,"0")};return`#${l(0)}${l(8)}${l(4)}`}const Treemap=React__namespace.forwardRef(({data:t,options:e,height:n="500px",className:o,loading:l,disableClick:d=!0,...f},g)=>{const b=React__namespace.useRef(null),[_,S]=React__namespace.useState(null);React__namespace.useEffect(()=>{if(!b.current)return;const E=b.current;let A;const M=()=>{const q=getComputedStyle(E).getPropertyValue("--primary").trim();if(q){const z=parseHsl(q);if(z){const{h:Q,s:F,l:V}=z;S({minColor:hslToHex(Q,F,Math.min(100,V+50)),midColor:hslToHex(Q,F,Math.min(100,V+35)),maxColor:hslToHex(Q,F,Math.min(100,V+20))})}return!0}return!1};if(M())return;let I=0;const j=20;return A=setInterval(()=>{(M()||I>=j)&&clearInterval(A),I++},100),()=>{A&&clearInterval(A)}},[]);const R=React__namespace.useMemo(()=>{const E={headerHeight:0,fontSize:14,showScale:!1,isHtml:!0,generateTooltip:(A,M)=>{var q;const I=(q=t[A+1])==null?void 0:q[0];if(!I)return"";const j=formatMoney(M);return`<div class="p-2 bg-background text-foreground border rounded-md shadow-lg">
1323
1323
  <strong>${I}</strong><br>Value: ${j}
1324
1324
  </div>`}};return _&&(!e||!e.colorAxis)&&(E.minColor=_.minColor,E.midColor=_.midColor,E.maxColor=_.maxColor),{...E,...e}},[t,e,_]),C=React__namespace.useMemo(()=>d?[{eventName:"select",callback:({chartWrapper:A})=>{A.getChart().setSelection(null)}}]:void 0,[d]);return React__namespace.useImperativeHandle(g,()=>b.current,[]),l?jsxRuntime.jsx("div",{ref:b,className:cn("w-full",o),style:{height:n},...f,children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full"})}):!t||t.length<=2?jsxRuntime.jsx("div",{ref:b,className:cn("w-full flex items-center justify-center text-muted-foreground",o),style:{height:n},...f,children:"No data available"}):jsxRuntime.jsx("div",{ref:b,className:cn("w-full",o),style:{height:n},...f,children:jsxRuntime.jsx(Chart,{chartType:"TreeMap",width:"100%",height:"100%",data:t,options:R,chartEvents:C,loader:jsxRuntime.jsx(Skeleton,{className:"h-full w-full"})})})});Treemap.displayName="Treemap";const TopPercentTreemap=({data:t,topPercent:e=80,title:n,loading:o,...l})=>{const d=React__namespace.useMemo(()=>{if(!t||t.length===0)return[["ID","Parent","Value"],["Root",null,0]];const g=[...t].sort((A,M)=>M.value-A.value),_=g.reduce((A,M)=>A+M.value,0)*(e/100),S=[["ID","Parent","Value"],["Root",null,0]],R=[],C=[];let E=0;for(const A of g)E<_?(R.push(A),E+=A.value):C.push(A);if(R.forEach(A=>{S.push([A.name,"Root",A.value])}),C.length>0){const A=`More... (${C.length} items)`;S.push([A,"Root",0]),C.forEach(M=>{S.push([M.name,A,M.value])})}return S},[t,e]),f=React__namespace.useMemo(()=>({title:n,maxDepth:1}),[n]);return jsxRuntime.jsx(Treemap,{data:d,options:f,className:cn("h-full",l.className),loading:o,disableClick:!1,...l})};exports.ActiveOrdersCard=ActiveOrdersCard,exports.AiGeneratedContent=AiGeneratedContent,exports.Alert=Alert,exports.AlertDescription=AlertDescription,exports.AlertDialog=AlertDialog,exports.AlertDialogAction=AlertDialogAction,exports.AlertDialogCancel=AlertDialogCancel,exports.AlertDialogContent=AlertDialogContent,exports.AlertDialogDescription=AlertDialogDescription,exports.AlertDialogFooter=AlertDialogFooter,exports.AlertDialogHeader=AlertDialogHeader,exports.AlertDialogTitle=AlertDialogTitle,exports.AlertDialogTrigger=AlertDialogTrigger,exports.AlertTitle=AlertTitle,exports.AreaChart=AreaChart,exports.AssistantChat=AssistantChat,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.ChatProvider=ChatProvider,exports.Checkbox=Checkbox,exports.Command=Command,exports.CommandDialog=CommandDialog,exports.CommandEmpty=CommandEmpty,exports.CommandGroup=CommandGroup,exports.CommandInput=CommandInput,exports.CommandItem=CommandItem,exports.CommandList=CommandList,exports.CommandSeparator=CommandSeparator,exports.CommandShortcut=CommandShortcut,exports.CountryFlag=CountryFlag,exports.DataTable=DataTable,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.ExploreManufacturers=ExploreManufacturers,exports.GeminiApiKeyProvider=GeminiApiKeyProvider,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.ManufacturerGetStartedButton=ManufacturerGetStartedButton,exports.ManufacturerOverviewPage=ManufacturerOverviewPage,exports.ManufacturerReorderingCard=ManufacturerReorderingCard,exports.MultiSelect=MultiSelect,exports.Navbar=Navbar,exports.OpportunitiesTable=OpportunitiesTable,exports.PageHeader=PageHeader,exports.PartnerCard=PartnerCard,exports.PartnerRelationshipPage=PartnerRelationshipPage,exports.Popover=Popover,exports.PopoverAnchor=PopoverAnchor,exports.PopoverContent=PopoverContent,exports.PopoverTrigger=PopoverTrigger,exports.Preloader=Preloader,exports.ProductCard=ProductCard,exports.ProductImage=ProductImage,exports.ProductInventoryGrid=ProductInventoryGrid,exports.ProductOverviewPage=ProductOverviewPage,exports.Progress=Progress,exports.RadioGroup=RadioGroup$1,exports.RadioGroupItem=RadioGroupItem,exports.ResellerBillingOverviewCard=ResellerBillingOverviewCard,exports.ResellerCard=ResellerCard,exports.ResellerOverview=ResellerOverview,exports.ResellerQualificationsCard=ResellerQualificationsCard,exports.ReturnsTable=ReturnsTable,exports.RichTextEditor=RichTextEditor,exports.SalesChart=SalesChart,exports.SalesOverviewCard=SalesOverviewCard,exports.ScrollArea=ScrollArea,exports.ScrollBar=ScrollBar,exports.Select=Select,exports.SelectContent=SelectContent,exports.SelectGroup=SelectGroup,exports.SelectItem=SelectItem,exports.SelectLabel=SelectLabel,exports.SelectScrollDownButton=SelectScrollDownButton,exports.SelectScrollUpButton=SelectScrollUpButton,exports.SelectTrigger=SelectTrigger,exports.SelectValue=SelectValue,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.Table=Table,exports.TableBody=TableBody,exports.TableCaption=TableCaption,exports.TableCell=TableCell,exports.TableFooter=TableFooter,exports.TableHead=TableHead,exports.TableHeader=TableHeader,exports.TableRow=TableRow,exports.Tabs=Tabs,exports.TabsContent=TabsContent,exports.TabsList=TabsList,exports.TabsTrigger=TabsTrigger,exports.Textarea=Textarea,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.TopPercentTreemap=TopPercentTreemap,exports.Topbar=Topbar,exports.Treemap=Treemap,exports.badgeVariants=badgeVariants,exports.buttonVariants=buttonVariants,exports.toast=toast,exports.useChat=useChat,exports.useGeminiApiKey=useGeminiApiKey,exports.useIsMobile=useIsMobile,exports.useSidebar=useSidebar,exports.useToast=useToast,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});