randmarcomps 1.269.0 → 1.271.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.
@@ -412,7 +412,7 @@
412
412
  *
413
413
  * This source code is licensed under the ISC license.
414
414
  * See the LICENSE file in the root directory of this source tree.
415
- */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 I=l[A];if(f===0&&g===0){if(I===MODIFIER_SEPARATOR){d.push(l.slice(b,A)),b=A+MODIFIER_SEPARATOR_LENGTH;continue}if(I==="/"){_=A;continue}}I==="["?f++:I==="]"?f--:I==="("?g++:I===")"&&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:I}=n(S);if(R){b=S+(b.length>0?" "+b:b);continue}let M=!!I,j=o(M?A.substring(0,I):A);if(!j){if(!M){b=S+(b.length>0?" "+b:b);continue}if(j=o(A),!j){b=S+(b.length>0?" "+b:b);continue}M=!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,M);for(let O=0;O<F.length;++O){const te=F[O];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))\(.+\)$/,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"),I=fromTheme("perspective"),M=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],O=()=>["auto","hidden","clip","visible","scroll"],te=()=>["auto","contain","none"],ne=()=>[isArbitraryVariable,isArbitraryValue,b],ae=()=>[isFraction,"full","auto",...ne()],ge=()=>[isInteger,"none","subgrid",isArbitraryVariable,isArbitraryValue],oe=()=>["auto",{span:["full",isInteger,isArbitraryVariable,isArbitraryValue]},isInteger,isArbitraryVariable,isArbitraryValue],je=()=>[isInteger,"auto",isArbitraryVariable,isArbitraryValue],Ne=()=>["auto","min","max","fr",isArbitraryVariable,isArbitraryValue],Ae=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$e=()=>["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()],Ve=()=>[t,isArbitraryVariable,isArbitraryValue],Be=()=>[...Q(),isArbitraryVariablePosition,isArbitraryPosition,{position:[isArbitraryVariable,isArbitraryValue]}],qe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Ke=()=>["auto","cover","contain",isArbitraryVariableSize,isArbitrarySize,{size:[isArbitraryVariable,isArbitraryValue]}],He=()=>[isPercent$1,isArbitraryVariableLength,isArbitraryLength],Xe=()=>["","none","full",_,isArbitraryVariable,isArbitraryValue],tt=()=>["",isNumber$4,isArbitraryVariableLength,isArbitraryLength],Ye=()=>["solid","dashed","dotted","double"],et=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ze=()=>[isNumber$4,isPercent$1,isArbitraryVariablePosition,isArbitraryPosition],at=()=>["","none",A,isArbitraryVariable,isArbitraryValue],rt=()=>["none",isNumber$4,isArbitraryVariable,isArbitraryValue],it=()=>["none",isNumber$4,isArbitraryVariable,isArbitraryValue],st=()=>[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,M]}],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:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:te()}],"overscroll-x":[{"overscroll-x":te()}],"overscroll-y":[{"overscroll-y":te()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ae()}],"inset-x":[{"inset-x":ae()}],"inset-y":[{"inset-y":ae()}],start:[{start:ae()}],end:[{end:ae()}],top:[{top:ae()}],right:[{right:ae()}],bottom:[{bottom:ae()}],left:[{left:ae()}],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":je()}],"col-end":[{"col-end":je()}],"grid-rows":[{"grid-rows":ge()}],"row-start-end":[{row:oe()}],"row-start":[{"row-start":je()}],"row-end":[{"row-end":je()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ne()}],"auto-rows":[{"auto-rows":Ne()}],gap:[{gap:ne()}],"gap-x":[{"gap-x":ne()}],"gap-y":[{"gap-y":ne()}],"justify-content":[{justify:[...Ae(),"normal"]}],"justify-items":[{"justify-items":[...$e(),"normal"]}],"justify-self":[{"justify-self":["auto",...$e()]}],"align-content":[{content:["normal",...Ae()]}],"align-items":[{items:[...$e(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$e(),{baseline:["","last"]}]}],"place-content":[{"place-content":Ae()}],"place-items":[{"place-items":[...$e(),"baseline"]}],"place-self":[{"place-self":["auto",...$e()]}],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:Ve()}],"text-color":[{text:Ve()}],"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:Ve()}],"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:Ke()}],"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:Ve()}],"gradient-from-pos":[{from:He()}],"gradient-via-pos":[{via:He()}],"gradient-to-pos":[{to:He()}],"gradient-from":[{from:Ve()}],"gradient-via":[{via:Ve()}],"gradient-to":[{to:Ve()}],rounded:[{rounded:Xe()}],"rounded-s":[{"rounded-s":Xe()}],"rounded-e":[{"rounded-e":Xe()}],"rounded-t":[{"rounded-t":Xe()}],"rounded-r":[{"rounded-r":Xe()}],"rounded-b":[{"rounded-b":Xe()}],"rounded-l":[{"rounded-l":Xe()}],"rounded-ss":[{"rounded-ss":Xe()}],"rounded-se":[{"rounded-se":Xe()}],"rounded-ee":[{"rounded-ee":Xe()}],"rounded-es":[{"rounded-es":Xe()}],"rounded-tl":[{"rounded-tl":Xe()}],"rounded-tr":[{"rounded-tr":Xe()}],"rounded-br":[{"rounded-br":Xe()}],"rounded-bl":[{"rounded-bl":Xe()}],"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:Ve()}],"border-color-x":[{"border-x":Ve()}],"border-color-y":[{"border-y":Ve()}],"border-color-s":[{"border-s":Ve()}],"border-color-e":[{"border-e":Ve()}],"border-color-t":[{"border-t":Ve()}],"border-color-r":[{"border-r":Ve()}],"border-color-b":[{"border-b":Ve()}],"border-color-l":[{"border-l":Ve()}],"divide-color":[{divide:Ve()}],"outline-style":[{outline:[...Ye(),"none","hidden"]}],"outline-offset":[{"outline-offset":[isNumber$4,isArbitraryVariable,isArbitraryValue]}],"outline-w":[{outline:["",isNumber$4,isArbitraryVariableLength,isArbitraryLength]}],"outline-color":[{outline:Ve()}],shadow:[{shadow:["","none",S,isArbitraryVariableShadow,isArbitraryShadow]}],"shadow-color":[{shadow:Ve()}],"inset-shadow":[{"inset-shadow":["none",R,isArbitraryVariableShadow,isArbitraryShadow]}],"inset-shadow-color":[{"inset-shadow":Ve()}],"ring-w":[{ring:tt()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Ve()}],"ring-offset-w":[{"ring-offset":[isNumber$4,isArbitraryLength]}],"ring-offset-color":[{"ring-offset":Ve()}],"inset-ring-w":[{"inset-ring":tt()}],"inset-ring-color":[{"inset-ring":Ve()}],"text-shadow":[{"text-shadow":["none",C,isArbitraryVariableShadow,isArbitraryShadow]}],"text-shadow-color":[{"text-shadow":Ve()}],opacity:[{opacity:[isNumber$4,isArbitraryVariable,isArbitraryValue]}],"mix-blend":[{"mix-blend":[...et(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":et()}],"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":Ze()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ze()}],"mask-image-linear-from-color":[{"mask-linear-from":Ve()}],"mask-image-linear-to-color":[{"mask-linear-to":Ve()}],"mask-image-t-from-pos":[{"mask-t-from":Ze()}],"mask-image-t-to-pos":[{"mask-t-to":Ze()}],"mask-image-t-from-color":[{"mask-t-from":Ve()}],"mask-image-t-to-color":[{"mask-t-to":Ve()}],"mask-image-r-from-pos":[{"mask-r-from":Ze()}],"mask-image-r-to-pos":[{"mask-r-to":Ze()}],"mask-image-r-from-color":[{"mask-r-from":Ve()}],"mask-image-r-to-color":[{"mask-r-to":Ve()}],"mask-image-b-from-pos":[{"mask-b-from":Ze()}],"mask-image-b-to-pos":[{"mask-b-to":Ze()}],"mask-image-b-from-color":[{"mask-b-from":Ve()}],"mask-image-b-to-color":[{"mask-b-to":Ve()}],"mask-image-l-from-pos":[{"mask-l-from":Ze()}],"mask-image-l-to-pos":[{"mask-l-to":Ze()}],"mask-image-l-from-color":[{"mask-l-from":Ve()}],"mask-image-l-to-color":[{"mask-l-to":Ve()}],"mask-image-x-from-pos":[{"mask-x-from":Ze()}],"mask-image-x-to-pos":[{"mask-x-to":Ze()}],"mask-image-x-from-color":[{"mask-x-from":Ve()}],"mask-image-x-to-color":[{"mask-x-to":Ve()}],"mask-image-y-from-pos":[{"mask-y-from":Ze()}],"mask-image-y-to-pos":[{"mask-y-to":Ze()}],"mask-image-y-from-color":[{"mask-y-from":Ve()}],"mask-image-y-to-color":[{"mask-y-to":Ve()}],"mask-image-radial":[{"mask-radial":[isArbitraryVariable,isArbitraryValue]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ze()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ze()}],"mask-image-radial-from-color":[{"mask-radial-from":Ve()}],"mask-image-radial-to-color":[{"mask-radial-to":Ve()}],"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":Ze()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ze()}],"mask-image-conic-from-color":[{"mask-conic-from":Ve()}],"mask-image-conic-to-color":[{"mask-conic-to":Ve()}],"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:Ke()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",isArbitraryVariable,isArbitraryValue]}],filter:[{filter:["","none",isArbitraryVariable,isArbitraryValue]}],blur:[{blur:at()}],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":Ve()}],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":at()}],"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:[I,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:it()}],"scale-x":[{"scale-x":it()}],"scale-y":[{"scale-y":it()}],"scale-z":[{"scale-z":it()}],"scale-3d":["scale-3d"],skew:[{skew:st()}],"skew-x":[{"skew-x":st()}],"skew-y":[{"skew-y":st()}],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:Ve()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Ve()}],"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",...Ve()]}],"stroke-w":[{stroke:[isNumber$4,isArbitraryVariableLength,isArbitraryLength,isArbitraryNumber]}],stroke:[{stroke:["none",...Ve()]}],"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))}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,I=((j=C==null?void 0:C[t])==null?void 0:j[b])||g,M=React__namespace.useMemo(()=>A,Object.values(A));return jsxRuntime.jsx(I.Provider,{value:M,children:E})};_.displayName=d+"Provider";function S(R,C){var I;const E=((I=C==null?void 0:C[t])==null?void 0:I[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=I=>{const{scope:M,children:j}=I,q=React.useRef(null),z=React.useRef(new Map).current;return jsxRuntime.jsx(l,{scope:M,itemMap:z,collectionRef:q,children:j})};f.displayName=e;const g=t+"CollectionSlot",b=createSlot(g),_=React.forwardRef((I,M)=>{const{scope:j,children:q}=I,z=d(g,j),Q=useComposedRefs(M,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((I,M)=>{const{scope:j,children:q,...z}=I,Q=React.useRef(null),F=useComposedRefs(M,Q),O=d(S,j);return React.useEffect(()=>(O.itemMap.set(Q,{ref:Q,...z}),()=>void O.itemMap.delete(Q))),jsxRuntime.jsx(C,{[R]:"",ref:F,children:q})});E.displayName=S;function A(I){const M=d(t+"CollectionConsumer",I);return React.useCallback(()=>{const q=M.collectionRef.current;if(!q)return[];const z=Array.from(q.querySelectorAll(`[${R}]`));return Array.from(M.itemMap.values()).sort((O,te)=>z.indexOf(O.ref.current)-z.indexOf(te.ref.current))},[M.collectionRef,M.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),[I,M]=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),[O,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:I,onItemFocus:React__namespace.useCallback(ne=>M(ne),[M]),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||O===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 ae=!F.current;if(ne.target===ne.currentTarget&&ae&&!j){const ge=new CustomEvent(ENTRY_FOCUS,EVENT_OPTIONS$1);if(ne.currentTarget.dispatchEvent(ge),!ge.defaultPrevented){const oe=Q().filter(Fe=>Fe.focusable),je=oe.find(Fe=>Fe.active),Ne=oe.find(Fe=>Fe.id===I),$e=[je,Ne,...oe].filter(Boolean).map(Fe=>Fe.ref.current);focusFirst$3($e,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:I}=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,M=>{o?S.onItemFocus(_):M.preventDefault()}),onFocus:composeEventHandlers(t.onFocus,()=>S.onItemFocus(_)),onKeyDown:composeEventHandlers(t.onKeyDown,M=>{if(M.key==="Tab"&&M.shiftKey){S.onItemShiftTab();return}if(M.target!==M.currentTarget)return;const j=getFocusIntent(M,S.orientation,S.dir);if(j!==void 0){if(M.metaKey||M.ctrlKey||M.altKey||M.shiftKey)return;M.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(M.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:I!=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 I=getAnimationName(o.current).includes(E.animationName);if(E.target===e&&I&&(b("ANIMATION_END"),!l.current)){const M=e.style.animationFillMode;e.style.animationFillMode="forwards",_=S.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=M)})}},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,M=>C(M)),A=React__namespace.useRef(!1),I=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,M=>{l||b==null||b(),I&&(A.current=M.isPropagationStopped(),A.current||M.stopPropagation())})}),I&&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(_),[I,M]=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:I,onValueChange:M,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=I=>{ARROW_KEYS.includes(I.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)),I=Array.from(_.layers),[M]=[..._.layersWithOutsidePointerEventsDisabled].slice(-1),j=I.indexOf(M),q=S?I.indexOf(S):-1,z=_.layersWithOutsidePointerEventsDisabled.size>0,Q=q>=j,F=usePointerDownOutside(te=>{const ne=te.target,ae=[..._.branches].some(ge=>ge.contains(ne));!Q||ae||(l==null||l(te),f==null||f(te),te.defaultPrevented||g==null||g())},C),O=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,O.onFocusCapture),onBlurCapture:composeEventHandlers(t.onBlurCapture,O.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,I=>b(I)),E=React__namespace.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;React__namespace.useEffect(()=>{if(o){let I=function(z){if(E.paused||!g)return;const Q=z.target;g.contains(Q)?R.current=Q:focus$1(R.current,{select:!0})},M=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",I),document.addEventListener("focusout",M);const q=new MutationObserver(j);return g&&q.observe(g,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",I),document.removeEventListener("focusout",M),q.disconnect()}}},[o,g,E.paused]),React__namespace.useEffect(()=>{if(g){focusScopesStack.add(E);const I=document.activeElement;if(!g.contains(I)){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===I&&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(I??document.body,{select:!0}),g.removeEventListener(AUTOFOCUS_ON_UNMOUNT,S),focusScopesStack.remove(E)},0)}}},[g,_,S,E]);const A=React__namespace.useCallback(I=>{if(!n&&!o||E.paused)return;const M=I.key==="Tab"&&!I.altKey&&!I.ctrlKey&&!I.metaKey,j=document.activeElement;if(M&&j){const q=I.currentTarget,[z,Q]=getTabbableEdges(q);z&&Q?!I.shiftKey&&j===Q?(I.preventDefault(),n&&focus$1(z,{select:!0})):I.shiftKey&&j===z&&(I.preventDefault(),n&&focus$1(Q,{select:!0})):j===q&&I.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,I=t.inert,M=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,O=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:I,setCallbacks:d,allowPinchZoom:!!M,lockRef:n,gapMode:z}),f?React__namespace.cloneElement(React__namespace.Children.only(g),__assign$1(__assign$1({},te),{ref:O})):React__namespace.createElement(q,__assign$1({},te,{className:b,ref:O}),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"),`
415
+ */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 I=l[A];if(f===0&&g===0){if(I===MODIFIER_SEPARATOR){d.push(l.slice(b,A)),b=A+MODIFIER_SEPARATOR_LENGTH;continue}if(I==="/"){_=A;continue}}I==="["?f++:I==="]"?f--:I==="("?g++:I===")"&&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:I}=n(S);if(R){b=S+(b.length>0?" "+b:b);continue}let M=!!I,j=o(M?A.substring(0,I):A);if(!j){if(!M){b=S+(b.length>0?" "+b:b);continue}if(j=o(A),!j){b=S+(b.length>0?" "+b:b);continue}M=!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,M);for(let O=0;O<F.length;++O){const te=F[O];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))\(.+\)$/,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"),I=fromTheme("perspective"),M=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],O=()=>["auto","hidden","clip","visible","scroll"],te=()=>["auto","contain","none"],ne=()=>[isArbitraryVariable,isArbitraryValue,b],ae=()=>[isFraction,"full","auto",...ne()],ge=()=>[isInteger,"none","subgrid",isArbitraryVariable,isArbitraryValue],oe=()=>["auto",{span:["full",isInteger,isArbitraryVariable,isArbitraryValue]},isInteger,isArbitraryVariable,isArbitraryValue],je=()=>[isInteger,"auto",isArbitraryVariable,isArbitraryValue],Ne=()=>["auto","min","max","fr",isArbitraryVariable,isArbitraryValue],Ae=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$e=()=>["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()],Ve=()=>[t,isArbitraryVariable,isArbitraryValue],Be=()=>[...Q(),isArbitraryVariablePosition,isArbitraryPosition,{position:[isArbitraryVariable,isArbitraryValue]}],qe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Ke=()=>["auto","cover","contain",isArbitraryVariableSize,isArbitrarySize,{size:[isArbitraryVariable,isArbitraryValue]}],He=()=>[isPercent$1,isArbitraryVariableLength,isArbitraryLength],Xe=()=>["","none","full",_,isArbitraryVariable,isArbitraryValue],tt=()=>["",isNumber$4,isArbitraryVariableLength,isArbitraryLength],Ye=()=>["solid","dashed","dotted","double"],et=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ze=()=>[isNumber$4,isPercent$1,isArbitraryVariablePosition,isArbitraryPosition],at=()=>["","none",A,isArbitraryVariable,isArbitraryValue],rt=()=>["none",isNumber$4,isArbitraryVariable,isArbitraryValue],it=()=>["none",isNumber$4,isArbitraryVariable,isArbitraryValue],st=()=>[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,M]}],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:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:te()}],"overscroll-x":[{"overscroll-x":te()}],"overscroll-y":[{"overscroll-y":te()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ae()}],"inset-x":[{"inset-x":ae()}],"inset-y":[{"inset-y":ae()}],start:[{start:ae()}],end:[{end:ae()}],top:[{top:ae()}],right:[{right:ae()}],bottom:[{bottom:ae()}],left:[{left:ae()}],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":je()}],"col-end":[{"col-end":je()}],"grid-rows":[{"grid-rows":ge()}],"row-start-end":[{row:oe()}],"row-start":[{"row-start":je()}],"row-end":[{"row-end":je()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ne()}],"auto-rows":[{"auto-rows":Ne()}],gap:[{gap:ne()}],"gap-x":[{"gap-x":ne()}],"gap-y":[{"gap-y":ne()}],"justify-content":[{justify:[...Ae(),"normal"]}],"justify-items":[{"justify-items":[...$e(),"normal"]}],"justify-self":[{"justify-self":["auto",...$e()]}],"align-content":[{content:["normal",...Ae()]}],"align-items":[{items:[...$e(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$e(),{baseline:["","last"]}]}],"place-content":[{"place-content":Ae()}],"place-items":[{"place-items":[...$e(),"baseline"]}],"place-self":[{"place-self":["auto",...$e()]}],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:Ve()}],"text-color":[{text:Ve()}],"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:Ve()}],"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:Ke()}],"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:Ve()}],"gradient-from-pos":[{from:He()}],"gradient-via-pos":[{via:He()}],"gradient-to-pos":[{to:He()}],"gradient-from":[{from:Ve()}],"gradient-via":[{via:Ve()}],"gradient-to":[{to:Ve()}],rounded:[{rounded:Xe()}],"rounded-s":[{"rounded-s":Xe()}],"rounded-e":[{"rounded-e":Xe()}],"rounded-t":[{"rounded-t":Xe()}],"rounded-r":[{"rounded-r":Xe()}],"rounded-b":[{"rounded-b":Xe()}],"rounded-l":[{"rounded-l":Xe()}],"rounded-ss":[{"rounded-ss":Xe()}],"rounded-se":[{"rounded-se":Xe()}],"rounded-ee":[{"rounded-ee":Xe()}],"rounded-es":[{"rounded-es":Xe()}],"rounded-tl":[{"rounded-tl":Xe()}],"rounded-tr":[{"rounded-tr":Xe()}],"rounded-br":[{"rounded-br":Xe()}],"rounded-bl":[{"rounded-bl":Xe()}],"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:Ve()}],"border-color-x":[{"border-x":Ve()}],"border-color-y":[{"border-y":Ve()}],"border-color-s":[{"border-s":Ve()}],"border-color-e":[{"border-e":Ve()}],"border-color-t":[{"border-t":Ve()}],"border-color-r":[{"border-r":Ve()}],"border-color-b":[{"border-b":Ve()}],"border-color-l":[{"border-l":Ve()}],"divide-color":[{divide:Ve()}],"outline-style":[{outline:[...Ye(),"none","hidden"]}],"outline-offset":[{"outline-offset":[isNumber$4,isArbitraryVariable,isArbitraryValue]}],"outline-w":[{outline:["",isNumber$4,isArbitraryVariableLength,isArbitraryLength]}],"outline-color":[{outline:Ve()}],shadow:[{shadow:["","none",S,isArbitraryVariableShadow,isArbitraryShadow]}],"shadow-color":[{shadow:Ve()}],"inset-shadow":[{"inset-shadow":["none",R,isArbitraryVariableShadow,isArbitraryShadow]}],"inset-shadow-color":[{"inset-shadow":Ve()}],"ring-w":[{ring:tt()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Ve()}],"ring-offset-w":[{"ring-offset":[isNumber$4,isArbitraryLength]}],"ring-offset-color":[{"ring-offset":Ve()}],"inset-ring-w":[{"inset-ring":tt()}],"inset-ring-color":[{"inset-ring":Ve()}],"text-shadow":[{"text-shadow":["none",C,isArbitraryVariableShadow,isArbitraryShadow]}],"text-shadow-color":[{"text-shadow":Ve()}],opacity:[{opacity:[isNumber$4,isArbitraryVariable,isArbitraryValue]}],"mix-blend":[{"mix-blend":[...et(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":et()}],"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":Ze()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ze()}],"mask-image-linear-from-color":[{"mask-linear-from":Ve()}],"mask-image-linear-to-color":[{"mask-linear-to":Ve()}],"mask-image-t-from-pos":[{"mask-t-from":Ze()}],"mask-image-t-to-pos":[{"mask-t-to":Ze()}],"mask-image-t-from-color":[{"mask-t-from":Ve()}],"mask-image-t-to-color":[{"mask-t-to":Ve()}],"mask-image-r-from-pos":[{"mask-r-from":Ze()}],"mask-image-r-to-pos":[{"mask-r-to":Ze()}],"mask-image-r-from-color":[{"mask-r-from":Ve()}],"mask-image-r-to-color":[{"mask-r-to":Ve()}],"mask-image-b-from-pos":[{"mask-b-from":Ze()}],"mask-image-b-to-pos":[{"mask-b-to":Ze()}],"mask-image-b-from-color":[{"mask-b-from":Ve()}],"mask-image-b-to-color":[{"mask-b-to":Ve()}],"mask-image-l-from-pos":[{"mask-l-from":Ze()}],"mask-image-l-to-pos":[{"mask-l-to":Ze()}],"mask-image-l-from-color":[{"mask-l-from":Ve()}],"mask-image-l-to-color":[{"mask-l-to":Ve()}],"mask-image-x-from-pos":[{"mask-x-from":Ze()}],"mask-image-x-to-pos":[{"mask-x-to":Ze()}],"mask-image-x-from-color":[{"mask-x-from":Ve()}],"mask-image-x-to-color":[{"mask-x-to":Ve()}],"mask-image-y-from-pos":[{"mask-y-from":Ze()}],"mask-image-y-to-pos":[{"mask-y-to":Ze()}],"mask-image-y-from-color":[{"mask-y-from":Ve()}],"mask-image-y-to-color":[{"mask-y-to":Ve()}],"mask-image-radial":[{"mask-radial":[isArbitraryVariable,isArbitraryValue]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ze()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ze()}],"mask-image-radial-from-color":[{"mask-radial-from":Ve()}],"mask-image-radial-to-color":[{"mask-radial-to":Ve()}],"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":Ze()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ze()}],"mask-image-conic-from-color":[{"mask-conic-from":Ve()}],"mask-image-conic-to-color":[{"mask-conic-to":Ve()}],"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:Ke()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",isArbitraryVariable,isArbitraryValue]}],filter:[{filter:["","none",isArbitraryVariable,isArbitraryValue]}],blur:[{blur:at()}],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":Ve()}],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":at()}],"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:[I,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:it()}],"scale-x":[{"scale-x":it()}],"scale-y":[{"scale-y":it()}],"scale-z":[{"scale-z":it()}],"scale-3d":["scale-3d"],skew:[{skew:st()}],"skew-x":[{"skew-x":st()}],"skew-y":[{"skew-y":st()}],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:Ve()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Ve()}],"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",...Ve()]}],"stroke-w":[{stroke:[isNumber$4,isArbitraryVariableLength,isArbitraryLength,isArbitraryNumber]}],stroke:[{stroke:["none",...Ve()]}],"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=>new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD"}).format(t);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,I=((j=C==null?void 0:C[t])==null?void 0:j[b])||g,M=React__namespace.useMemo(()=>A,Object.values(A));return jsxRuntime.jsx(I.Provider,{value:M,children:E})};_.displayName=d+"Provider";function S(R,C){var I;const E=((I=C==null?void 0:C[t])==null?void 0:I[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=I=>{const{scope:M,children:j}=I,q=React.useRef(null),z=React.useRef(new Map).current;return jsxRuntime.jsx(l,{scope:M,itemMap:z,collectionRef:q,children:j})};f.displayName=e;const g=t+"CollectionSlot",b=createSlot(g),_=React.forwardRef((I,M)=>{const{scope:j,children:q}=I,z=d(g,j),Q=useComposedRefs(M,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((I,M)=>{const{scope:j,children:q,...z}=I,Q=React.useRef(null),F=useComposedRefs(M,Q),O=d(S,j);return React.useEffect(()=>(O.itemMap.set(Q,{ref:Q,...z}),()=>void O.itemMap.delete(Q))),jsxRuntime.jsx(C,{[R]:"",ref:F,children:q})});E.displayName=S;function A(I){const M=d(t+"CollectionConsumer",I);return React.useCallback(()=>{const q=M.collectionRef.current;if(!q)return[];const z=Array.from(q.querySelectorAll(`[${R}]`));return Array.from(M.itemMap.values()).sort((O,te)=>z.indexOf(O.ref.current)-z.indexOf(te.ref.current))},[M.collectionRef,M.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),[I,M]=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),[O,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:I,onItemFocus:React__namespace.useCallback(ne=>M(ne),[M]),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||O===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 ae=!F.current;if(ne.target===ne.currentTarget&&ae&&!j){const ge=new CustomEvent(ENTRY_FOCUS,EVENT_OPTIONS$1);if(ne.currentTarget.dispatchEvent(ge),!ge.defaultPrevented){const oe=Q().filter(Fe=>Fe.focusable),je=oe.find(Fe=>Fe.active),Ne=oe.find(Fe=>Fe.id===I),$e=[je,Ne,...oe].filter(Boolean).map(Fe=>Fe.ref.current);focusFirst$3($e,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:I}=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,M=>{o?S.onItemFocus(_):M.preventDefault()}),onFocus:composeEventHandlers(t.onFocus,()=>S.onItemFocus(_)),onKeyDown:composeEventHandlers(t.onKeyDown,M=>{if(M.key==="Tab"&&M.shiftKey){S.onItemShiftTab();return}if(M.target!==M.currentTarget)return;const j=getFocusIntent(M,S.orientation,S.dir);if(j!==void 0){if(M.metaKey||M.ctrlKey||M.altKey||M.shiftKey)return;M.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(M.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:I!=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 I=getAnimationName(o.current).includes(E.animationName);if(E.target===e&&I&&(b("ANIMATION_END"),!l.current)){const M=e.style.animationFillMode;e.style.animationFillMode="forwards",_=S.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=M)})}},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,M=>C(M)),A=React__namespace.useRef(!1),I=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,M=>{l||b==null||b(),I&&(A.current=M.isPropagationStopped(),A.current||M.stopPropagation())})}),I&&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(_),[I,M]=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:I,onValueChange:M,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=I=>{ARROW_KEYS.includes(I.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)),I=Array.from(_.layers),[M]=[..._.layersWithOutsidePointerEventsDisabled].slice(-1),j=I.indexOf(M),q=S?I.indexOf(S):-1,z=_.layersWithOutsidePointerEventsDisabled.size>0,Q=q>=j,F=usePointerDownOutside(te=>{const ne=te.target,ae=[..._.branches].some(ge=>ge.contains(ne));!Q||ae||(l==null||l(te),f==null||f(te),te.defaultPrevented||g==null||g())},C),O=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,O.onFocusCapture),onBlurCapture:composeEventHandlers(t.onBlurCapture,O.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,I=>b(I)),E=React__namespace.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;React__namespace.useEffect(()=>{if(o){let I=function(z){if(E.paused||!g)return;const Q=z.target;g.contains(Q)?R.current=Q:focus$1(R.current,{select:!0})},M=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",I),document.addEventListener("focusout",M);const q=new MutationObserver(j);return g&&q.observe(g,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",I),document.removeEventListener("focusout",M),q.disconnect()}}},[o,g,E.paused]),React__namespace.useEffect(()=>{if(g){focusScopesStack.add(E);const I=document.activeElement;if(!g.contains(I)){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===I&&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(I??document.body,{select:!0}),g.removeEventListener(AUTOFOCUS_ON_UNMOUNT,S),focusScopesStack.remove(E)},0)}}},[g,_,S,E]);const A=React__namespace.useCallback(I=>{if(!n&&!o||E.paused)return;const M=I.key==="Tab"&&!I.altKey&&!I.ctrlKey&&!I.metaKey,j=document.activeElement;if(M&&j){const q=I.currentTarget,[z,Q]=getTabbableEdges(q);z&&Q?!I.shiftKey&&j===Q?(I.preventDefault(),n&&focus$1(z,{select:!0})):I.shiftKey&&j===z&&(I.preventDefault(),n&&focus$1(Q,{select:!0})):j===q&&I.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,I=t.inert,M=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,O=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:I,setCallbacks:d,allowPinchZoom:!!M,lockRef:n,gapMode:z}),f?React__namespace.cloneElement(React__namespace.Children.only(g),__assign$1(__assign$1({},te),{ref:O})):React__namespace.createElement(q,__assign$1({},te,{className:b,ref:O}),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"),`
416
416
  .`.concat(noScrollbarsClassName,` {
417
417
  overflow: hidden `).concat(o,`;
418
418
  padding-right: `).concat(g,"px ").concat(o,`;
@@ -456,7 +456,7 @@
456
456
 
457
457
  If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
458
458
 
459
- For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return React__namespace.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},DESCRIPTION_WARNING_NAME="DialogDescriptionWarning",DescriptionWarning$1=({contentRef:t,descriptionId:e})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${useWarningContext(DESCRIPTION_WARNING_NAME).contentName}}.`;return React__namespace.useEffect(()=>{var d;const l=(d=t.current)==null?void 0:d.getAttribute("aria-describedby");e&&l&&(document.getElementById(e)||console.warn(o))},[o,t,e]),null},Root$8=Dialog$1,Trigger$5=DialogTrigger$1,Portal$4=DialogPortal$1,Overlay=DialogOverlay$1,Content$2=DialogContent$1,Title$1=DialogTitle$1,Description$1=DialogDescription$1,Close$1=DialogClose$1;const Dialog=({modal:t=!1,...e})=>jsxRuntime.jsx(Root$8,{modal:t,...e});Dialog.displayName=Root$8.displayName;const DialogTrigger=Trigger$5,DialogPortal=Portal$4,DialogClose=Close$1,DialogOverlay=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Overlay,{ref:n,className:cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));DialogOverlay.displayName=Overlay.displayName;const DialogContent=React__namespace.forwardRef(({className:t,children:e,animateExit:n=!0,...o},l)=>jsxRuntime.jsxs(DialogPortal,{forceMount:o.forceMount,children:[jsxRuntime.jsx(DialogOverlay,{}),jsxRuntime.jsxs(Content$2,{ref:l,className:cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-2xl shadow-primary duration-200 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n&&"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]",t),...o,children:[e,jsxRuntime.jsxs(Close$1,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[jsxRuntime.jsx(X$1,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));DialogContent.displayName=Content$2.displayName;const DialogHeader=({className:t,...e})=>jsxRuntime.jsx("div",{className:cn("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});DialogHeader.displayName="DialogHeader";const DialogFooter=({className:t,...e})=>jsxRuntime.jsx("div",{className:cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});DialogFooter.displayName="DialogFooter";const DialogTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Title$1,{ref:n,className:cn("text-lg font-semibold leading-none tracking-tight",t),...e}));DialogTitle.displayName=Title$1.displayName;const DialogDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Description$1,{ref:n,className:cn("text-sm text-muted-foreground",t),...e}));DialogDescription.displayName=Description$1.displayName;const sides=["top","right","bottom","left"],min$3=Math.min,max$3=Math.max,round$1=Math.round,floor=Math.floor,createCoords=t=>({x:t,y:t}),oppositeSideMap={left:"right",right:"left",bottom:"top",top:"bottom"},oppositeAlignmentMap={start:"end",end:"start"};function clamp$1(t,e,n){return max$3(t,min$3(e,n))}function evaluate(t,e){return typeof t=="function"?t(e):t}function getSide$1(t){return t.split("-")[0]}function getAlignment(t){return t.split("-")[1]}function getOppositeAxis(t){return t==="x"?"y":"x"}function getAxisLength(t){return t==="y"?"height":"width"}function getSideAxis(t){return["top","bottom"].includes(getSide$1(t))?"y":"x"}function getAlignmentAxis(t){return getOppositeAxis(getSideAxis(t))}function getAlignmentSides(t,e,n){n===void 0&&(n=!1);const o=getAlignment(t),l=getAlignmentAxis(t),d=getAxisLength(l);let f=l==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[d]>e.floating[d]&&(f=getOppositePlacement(f)),[f,getOppositePlacement(f)]}function getExpandedPlacements(t){const e=getOppositePlacement(t);return[getOppositeAlignmentPlacement(t),e,getOppositeAlignmentPlacement(e)]}function getOppositeAlignmentPlacement(t){return t.replace(/start|end/g,e=>oppositeAlignmentMap[e])}function getSideList(t,e,n){const o=["left","right"],l=["right","left"],d=["top","bottom"],f=["bottom","top"];switch(t){case"top":case"bottom":return n?e?l:o:e?o:l;case"left":case"right":return e?d:f;default:return[]}}function getOppositeAxisPlacements(t,e,n,o){const l=getAlignment(t);let d=getSideList(getSide$1(t),n==="start",o);return l&&(d=d.map(f=>f+"-"+l),e&&(d=d.concat(d.map(getOppositeAlignmentPlacement)))),d}function getOppositePlacement(t){return t.replace(/left|right|bottom|top/g,e=>oppositeSideMap[e])}function expandPaddingObject(t){return{top:0,right:0,bottom:0,left:0,...t}}function getPaddingObject(t){return typeof t!="number"?expandPaddingObject(t):{top:t,right:t,bottom:t,left:t}}function rectToClientRect(t){const{x:e,y:n,width:o,height:l}=t;return{width:o,height:l,top:n,left:e,right:e+o,bottom:n+l,x:e,y:n}}function computeCoordsFromPlacement(t,e,n){let{reference:o,floating:l}=t;const d=getSideAxis(e),f=getAlignmentAxis(e),g=getAxisLength(f),b=getSide$1(e),_=d==="y",S=o.x+o.width/2-l.width/2,R=o.y+o.height/2-l.height/2,C=o[g]/2-l[g]/2;let E;switch(b){case"top":E={x:S,y:o.y-l.height};break;case"bottom":E={x:S,y:o.y+o.height};break;case"right":E={x:o.x+o.width,y:R};break;case"left":E={x:o.x-l.width,y:R};break;default:E={x:o.x,y:o.y}}switch(getAlignment(e)){case"start":E[f]-=C*(n&&_?-1:1);break;case"end":E[f]+=C*(n&&_?-1:1);break}return E}const computePosition$1=async(t,e,n)=>{const{placement:o="bottom",strategy:l="absolute",middleware:d=[],platform:f}=n,g=d.filter(Boolean),b=await(f.isRTL==null?void 0:f.isRTL(e));let _=await f.getElementRects({reference:t,floating:e,strategy:l}),{x:S,y:R}=computeCoordsFromPlacement(_,o,b),C=o,E={},A=0;for(let I=0;I<g.length;I++){const{name:M,fn:j}=g[I],{x:q,y:z,data:Q,reset:F}=await j({x:S,y:R,initialPlacement:o,placement:C,strategy:l,middlewareData:E,rects:_,platform:f,elements:{reference:t,floating:e}});S=q??S,R=z??R,E={...E,[M]:{...E[M],...Q}},F&&A<=50&&(A++,typeof F=="object"&&(F.placement&&(C=F.placement),F.rects&&(_=F.rects===!0?await f.getElementRects({reference:t,floating:e,strategy:l}):F.rects),{x:S,y:R}=computeCoordsFromPlacement(_,C,b)),I=-1)}return{x:S,y:R,placement:C,strategy:l,middlewareData:E}};async function detectOverflow(t,e){var n;e===void 0&&(e={});const{x:o,y:l,platform:d,rects:f,elements:g,strategy:b}=t,{boundary:_="clippingAncestors",rootBoundary:S="viewport",elementContext:R="floating",altBoundary:C=!1,padding:E=0}=evaluate(e,t),A=getPaddingObject(E),M=g[C?R==="floating"?"reference":"floating":R],j=rectToClientRect(await d.getClippingRect({element:(n=await(d.isElement==null?void 0:d.isElement(M)))==null||n?M:M.contextElement||await(d.getDocumentElement==null?void 0:d.getDocumentElement(g.floating)),boundary:_,rootBoundary:S,strategy:b})),q=R==="floating"?{x:o,y:l,width:f.floating.width,height:f.floating.height}:f.reference,z=await(d.getOffsetParent==null?void 0:d.getOffsetParent(g.floating)),Q=await(d.isElement==null?void 0:d.isElement(z))?await(d.getScale==null?void 0:d.getScale(z))||{x:1,y:1}:{x:1,y:1},F=rectToClientRect(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:g,rect:q,offsetParent:z,strategy:b}):q);return{top:(j.top-F.top+A.top)/Q.y,bottom:(F.bottom-j.bottom+A.bottom)/Q.y,left:(j.left-F.left+A.left)/Q.x,right:(F.right-j.right+A.right)/Q.x}}const arrow$4=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:l,rects:d,platform:f,elements:g,middlewareData:b}=e,{element:_,padding:S=0}=evaluate(t,e)||{};if(_==null)return{};const R=getPaddingObject(S),C={x:n,y:o},E=getAlignmentAxis(l),A=getAxisLength(E),I=await f.getDimensions(_),M=E==="y",j=M?"top":"left",q=M?"bottom":"right",z=M?"clientHeight":"clientWidth",Q=d.reference[A]+d.reference[E]-C[E]-d.floating[A],F=C[E]-d.reference[E],O=await(f.getOffsetParent==null?void 0:f.getOffsetParent(_));let te=O?O[z]:0;(!te||!await(f.isElement==null?void 0:f.isElement(O)))&&(te=g.floating[z]||d.floating[A]);const ne=Q/2-F/2,ae=te/2-I[A]/2-1,ge=min$3(R[j],ae),oe=min$3(R[q],ae),je=ge,Ne=te-I[A]-oe,Ae=te/2-I[A]/2+ne,$e=clamp$1(je,Ae,Ne),Fe=!b.arrow&&getAlignment(l)!=null&&Ae!==$e&&d.reference[A]/2-(Ae<je?ge:oe)-I[A]/2<0,ze=Fe?Ae<je?Ae-je:Ae-Ne:0;return{[E]:C[E]+ze,data:{[E]:$e,centerOffset:Ae-$e-ze,...Fe&&{alignmentOffset:ze}},reset:Fe}}}),flip$2=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:l,middlewareData:d,rects:f,initialPlacement:g,platform:b,elements:_}=e,{mainAxis:S=!0,crossAxis:R=!0,fallbackPlacements:C,fallbackStrategy:E="bestFit",fallbackAxisSideDirection:A="none",flipAlignment:I=!0,...M}=evaluate(t,e);if((n=d.arrow)!=null&&n.alignmentOffset)return{};const j=getSide$1(l),q=getSideAxis(g),z=getSide$1(g)===g,Q=await(b.isRTL==null?void 0:b.isRTL(_.floating)),F=C||(z||!I?[getOppositePlacement(g)]:getExpandedPlacements(g)),O=A!=="none";!C&&O&&F.push(...getOppositeAxisPlacements(g,I,A,Q));const te=[g,...F],ne=await detectOverflow(e,M),ae=[];let ge=((o=d.flip)==null?void 0:o.overflows)||[];if(S&&ae.push(ne[j]),R){const Ae=getAlignmentSides(l,f,Q);ae.push(ne[Ae[0]],ne[Ae[1]])}if(ge=[...ge,{placement:l,overflows:ae}],!ae.every(Ae=>Ae<=0)){var oe,je;const Ae=(((oe=d.flip)==null?void 0:oe.index)||0)+1,$e=te[Ae];if($e&&(!(R==="alignment"?q!==getSideAxis($e):!1)||ge.every(Ve=>Ve.overflows[0]>0&&getSideAxis(Ve.placement)===q)))return{data:{index:Ae,overflows:ge},reset:{placement:$e}};let Fe=(je=ge.filter(ze=>ze.overflows[0]<=0).sort((ze,Ve)=>ze.overflows[1]-Ve.overflows[1])[0])==null?void 0:je.placement;if(!Fe)switch(E){case"bestFit":{var Ne;const ze=(Ne=ge.filter(Ve=>{if(O){const Be=getSideAxis(Ve.placement);return Be===q||Be==="y"}return!0}).map(Ve=>[Ve.placement,Ve.overflows.filter(Be=>Be>0).reduce((Be,qe)=>Be+qe,0)]).sort((Ve,Be)=>Ve[1]-Be[1])[0])==null?void 0:Ne[0];ze&&(Fe=ze);break}case"initialPlacement":Fe=g;break}if(l!==Fe)return{reset:{placement:Fe}}}return{}}}};function getSideOffsets(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function isAnySideFullyClipped(t){return sides.some(e=>t[e]>=0)}const hide$2=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:o="referenceHidden",...l}=evaluate(t,e);switch(o){case"referenceHidden":{const d=await detectOverflow(e,{...l,elementContext:"reference"}),f=getSideOffsets(d,n.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:isAnySideFullyClipped(f)}}}case"escaped":{const d=await detectOverflow(e,{...l,altBoundary:!0}),f=getSideOffsets(d,n.floating);return{data:{escapedOffsets:f,escaped:isAnySideFullyClipped(f)}}}default:return{}}}}};async function convertValueToCoords(t,e){const{placement:n,platform:o,elements:l}=t,d=await(o.isRTL==null?void 0:o.isRTL(l.floating)),f=getSide$1(n),g=getAlignment(n),b=getSideAxis(n)==="y",_=["left","top"].includes(f)?-1:1,S=d&&b?-1:1,R=evaluate(e,t);let{mainAxis:C,crossAxis:E,alignmentAxis:A}=typeof R=="number"?{mainAxis:R,crossAxis:0,alignmentAxis:null}:{mainAxis:R.mainAxis||0,crossAxis:R.crossAxis||0,alignmentAxis:R.alignmentAxis};return g&&typeof A=="number"&&(E=g==="end"?A*-1:A),b?{x:E*S,y:C*_}:{x:C*_,y:E*S}}const offset$2=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:l,y:d,placement:f,middlewareData:g}=e,b=await convertValueToCoords(e,t);return f===((n=g.offset)==null?void 0:n.placement)&&(o=g.arrow)!=null&&o.alignmentOffset?{}:{x:l+b.x,y:d+b.y,data:{...b,placement:f}}}}},shift$3=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:l}=e,{mainAxis:d=!0,crossAxis:f=!1,limiter:g={fn:M=>{let{x:j,y:q}=M;return{x:j,y:q}}},...b}=evaluate(t,e),_={x:n,y:o},S=await detectOverflow(e,b),R=getSideAxis(getSide$1(l)),C=getOppositeAxis(R);let E=_[C],A=_[R];if(d){const M=C==="y"?"top":"left",j=C==="y"?"bottom":"right",q=E+S[M],z=E-S[j];E=clamp$1(q,E,z)}if(f){const M=R==="y"?"top":"left",j=R==="y"?"bottom":"right",q=A+S[M],z=A-S[j];A=clamp$1(q,A,z)}const I=g.fn({...e,[C]:E,[R]:A});return{...I,data:{x:I.x-n,y:I.y-o,enabled:{[C]:d,[R]:f}}}}}},limitShift$2=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:l,rects:d,middlewareData:f}=e,{offset:g=0,mainAxis:b=!0,crossAxis:_=!0}=evaluate(t,e),S={x:n,y:o},R=getSideAxis(l),C=getOppositeAxis(R);let E=S[C],A=S[R];const I=evaluate(g,e),M=typeof I=="number"?{mainAxis:I,crossAxis:0}:{mainAxis:0,crossAxis:0,...I};if(b){const z=C==="y"?"height":"width",Q=d.reference[C]-d.floating[z]+M.mainAxis,F=d.reference[C]+d.reference[z]-M.mainAxis;E<Q?E=Q:E>F&&(E=F)}if(_){var j,q;const z=C==="y"?"width":"height",Q=["top","left"].includes(getSide$1(l)),F=d.reference[R]-d.floating[z]+(Q&&((j=f.offset)==null?void 0:j[R])||0)+(Q?0:M.crossAxis),O=d.reference[R]+d.reference[z]+(Q?0:((q=f.offset)==null?void 0:q[R])||0)-(Q?M.crossAxis:0);A<F?A=F:A>O&&(A=O)}return{[C]:E,[R]:A}}}},size$2=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:l,rects:d,platform:f,elements:g}=e,{apply:b=()=>{},..._}=evaluate(t,e),S=await detectOverflow(e,_),R=getSide$1(l),C=getAlignment(l),E=getSideAxis(l)==="y",{width:A,height:I}=d.floating;let M,j;R==="top"||R==="bottom"?(M=R,j=C===(await(f.isRTL==null?void 0:f.isRTL(g.floating))?"start":"end")?"left":"right"):(j=R,M=C==="end"?"top":"bottom");const q=I-S.top-S.bottom,z=A-S.left-S.right,Q=min$3(I-S[M],q),F=min$3(A-S[j],z),O=!e.middlewareData.shift;let te=Q,ne=F;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(ne=z),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(te=q),O&&!C){const ge=max$3(S.left,0),oe=max$3(S.right,0),je=max$3(S.top,0),Ne=max$3(S.bottom,0);E?ne=A-2*(ge!==0||oe!==0?ge+oe:max$3(S.left,S.right)):te=I-2*(je!==0||Ne!==0?je+Ne:max$3(S.top,S.bottom))}await b({...e,availableWidth:ne,availableHeight:te});const ae=await f.getDimensions(g.floating);return A!==ae.width||I!==ae.height?{reset:{rects:!0}}:{}}}};function hasWindow(){return typeof window<"u"}function getNodeName(t){return isNode(t)?(t.nodeName||"").toLowerCase():"#document"}function getWindow(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function getDocumentElement(t){var e;return(e=(isNode(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function isNode(t){return hasWindow()?t instanceof Node||t instanceof getWindow(t).Node:!1}function isElement(t){return hasWindow()?t instanceof Element||t instanceof getWindow(t).Element:!1}function isHTMLElement$2(t){return hasWindow()?t instanceof HTMLElement||t instanceof getWindow(t).HTMLElement:!1}function isShadowRoot(t){return!hasWindow()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof getWindow(t).ShadowRoot}function isOverflowElement(t){const{overflow:e,overflowX:n,overflowY:o,display:l}=getComputedStyle$1(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(l)}function isTableElement(t){return["table","td","th"].includes(getNodeName(t))}function isTopLayer(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function isContainingBlock(t){const e=isWebKit(),n=isElement(t)?getComputedStyle$1(t):t;return["transform","translate","scale","rotate","perspective"].some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(o=>(n.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(n.contain||"").includes(o))}function getContainingBlock(t){let e=getParentNode(t);for(;isHTMLElement$2(e)&&!isLastTraversableNode(e);){if(isContainingBlock(e))return e;if(isTopLayer(e))return null;e=getParentNode(e)}return null}function isWebKit(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function isLastTraversableNode(t){return["html","body","#document"].includes(getNodeName(t))}function getComputedStyle$1(t){return getWindow(t).getComputedStyle(t)}function getNodeScroll(t){return isElement(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function getParentNode(t){if(getNodeName(t)==="html")return t;const e=t.assignedSlot||t.parentNode||isShadowRoot(t)&&t.host||getDocumentElement(t);return isShadowRoot(e)?e.host:e}function getNearestOverflowAncestor(t){const e=getParentNode(t);return isLastTraversableNode(e)?t.ownerDocument?t.ownerDocument.body:t.body:isHTMLElement$2(e)&&isOverflowElement(e)?e:getNearestOverflowAncestor(e)}function getOverflowAncestors(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const l=getNearestOverflowAncestor(t),d=l===((o=t.ownerDocument)==null?void 0:o.body),f=getWindow(l);if(d){const g=getFrameElement(f);return e.concat(f,f.visualViewport||[],isOverflowElement(l)?l:[],g&&n?getOverflowAncestors(g):[])}return e.concat(l,getOverflowAncestors(l,[],n))}function getFrameElement(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function getCssDimensions(t){const e=getComputedStyle$1(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const l=isHTMLElement$2(t),d=l?t.offsetWidth:n,f=l?t.offsetHeight:o,g=round$1(n)!==d||round$1(o)!==f;return g&&(n=d,o=f),{width:n,height:o,$:g}}function unwrapElement(t){return isElement(t)?t:t.contextElement}function getScale(t){const e=unwrapElement(t);if(!isHTMLElement$2(e))return createCoords(1);const n=e.getBoundingClientRect(),{width:o,height:l,$:d}=getCssDimensions(e);let f=(d?round$1(n.width):n.width)/o,g=(d?round$1(n.height):n.height)/l;return(!f||!Number.isFinite(f))&&(f=1),(!g||!Number.isFinite(g))&&(g=1),{x:f,y:g}}const noOffsets=createCoords(0);function getVisualOffsets(t){const e=getWindow(t);return!isWebKit()||!e.visualViewport?noOffsets:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function shouldAddVisualOffsets(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==getWindow(t)?!1:e}function getBoundingClientRect(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const l=t.getBoundingClientRect(),d=unwrapElement(t);let f=createCoords(1);e&&(o?isElement(o)&&(f=getScale(o)):f=getScale(t));const g=shouldAddVisualOffsets(d,n,o)?getVisualOffsets(d):createCoords(0);let b=(l.left+g.x)/f.x,_=(l.top+g.y)/f.y,S=l.width/f.x,R=l.height/f.y;if(d){const C=getWindow(d),E=o&&isElement(o)?getWindow(o):o;let A=C,I=getFrameElement(A);for(;I&&o&&E!==A;){const M=getScale(I),j=I.getBoundingClientRect(),q=getComputedStyle$1(I),z=j.left+(I.clientLeft+parseFloat(q.paddingLeft))*M.x,Q=j.top+(I.clientTop+parseFloat(q.paddingTop))*M.y;b*=M.x,_*=M.y,S*=M.x,R*=M.y,b+=z,_+=Q,A=getWindow(I),I=getFrameElement(A)}}return rectToClientRect({width:S,height:R,x:b,y:_})}function getWindowScrollBarX(t,e){const n=getNodeScroll(t).scrollLeft;return e?e.left+n:getBoundingClientRect(getDocumentElement(t)).left+n}function getHTMLOffset(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),l=o.left+e.scrollLeft-(n?0:getWindowScrollBarX(t,o)),d=o.top+e.scrollTop;return{x:l,y:d}}function convertOffsetParentRelativeRectToViewportRelativeRect(t){let{elements:e,rect:n,offsetParent:o,strategy:l}=t;const d=l==="fixed",f=getDocumentElement(o),g=e?isTopLayer(e.floating):!1;if(o===f||g&&d)return n;let b={scrollLeft:0,scrollTop:0},_=createCoords(1);const S=createCoords(0),R=isHTMLElement$2(o);if((R||!R&&!d)&&((getNodeName(o)!=="body"||isOverflowElement(f))&&(b=getNodeScroll(o)),isHTMLElement$2(o))){const E=getBoundingClientRect(o);_=getScale(o),S.x=E.x+o.clientLeft,S.y=E.y+o.clientTop}const C=f&&!R&&!d?getHTMLOffset(f,b,!0):createCoords(0);return{width:n.width*_.x,height:n.height*_.y,x:n.x*_.x-b.scrollLeft*_.x+S.x+C.x,y:n.y*_.y-b.scrollTop*_.y+S.y+C.y}}function getClientRects(t){return Array.from(t.getClientRects())}function getDocumentRect(t){const e=getDocumentElement(t),n=getNodeScroll(t),o=t.ownerDocument.body,l=max$3(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),d=max$3(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let f=-n.scrollLeft+getWindowScrollBarX(t);const g=-n.scrollTop;return getComputedStyle$1(o).direction==="rtl"&&(f+=max$3(e.clientWidth,o.clientWidth)-l),{width:l,height:d,x:f,y:g}}function getViewportRect(t,e){const n=getWindow(t),o=getDocumentElement(t),l=n.visualViewport;let d=o.clientWidth,f=o.clientHeight,g=0,b=0;if(l){d=l.width,f=l.height;const _=isWebKit();(!_||_&&e==="fixed")&&(g=l.offsetLeft,b=l.offsetTop)}return{width:d,height:f,x:g,y:b}}function getInnerBoundingClientRect(t,e){const n=getBoundingClientRect(t,!0,e==="fixed"),o=n.top+t.clientTop,l=n.left+t.clientLeft,d=isHTMLElement$2(t)?getScale(t):createCoords(1),f=t.clientWidth*d.x,g=t.clientHeight*d.y,b=l*d.x,_=o*d.y;return{width:f,height:g,x:b,y:_}}function getClientRectFromClippingAncestor(t,e,n){let o;if(e==="viewport")o=getViewportRect(t,n);else if(e==="document")o=getDocumentRect(getDocumentElement(t));else if(isElement(e))o=getInnerBoundingClientRect(e,n);else{const l=getVisualOffsets(t);o={x:e.x-l.x,y:e.y-l.y,width:e.width,height:e.height}}return rectToClientRect(o)}function hasFixedPositionAncestor(t,e){const n=getParentNode(t);return n===e||!isElement(n)||isLastTraversableNode(n)?!1:getComputedStyle$1(n).position==="fixed"||hasFixedPositionAncestor(n,e)}function getClippingElementAncestors(t,e){const n=e.get(t);if(n)return n;let o=getOverflowAncestors(t,[],!1).filter(g=>isElement(g)&&getNodeName(g)!=="body"),l=null;const d=getComputedStyle$1(t).position==="fixed";let f=d?getParentNode(t):t;for(;isElement(f)&&!isLastTraversableNode(f);){const g=getComputedStyle$1(f),b=isContainingBlock(f);!b&&g.position==="fixed"&&(l=null),(d?!b&&!l:!b&&g.position==="static"&&!!l&&["absolute","fixed"].includes(l.position)||isOverflowElement(f)&&!b&&hasFixedPositionAncestor(t,f))?o=o.filter(S=>S!==f):l=g,f=getParentNode(f)}return e.set(t,o),o}function getClippingRect(t){let{element:e,boundary:n,rootBoundary:o,strategy:l}=t;const f=[...n==="clippingAncestors"?isTopLayer(e)?[]:getClippingElementAncestors(e,this._c):[].concat(n),o],g=f[0],b=f.reduce((_,S)=>{const R=getClientRectFromClippingAncestor(e,S,l);return _.top=max$3(R.top,_.top),_.right=min$3(R.right,_.right),_.bottom=min$3(R.bottom,_.bottom),_.left=max$3(R.left,_.left),_},getClientRectFromClippingAncestor(e,g,l));return{width:b.right-b.left,height:b.bottom-b.top,x:b.left,y:b.top}}function getDimensions(t){const{width:e,height:n}=getCssDimensions(t);return{width:e,height:n}}function getRectRelativeToOffsetParent(t,e,n){const o=isHTMLElement$2(e),l=getDocumentElement(e),d=n==="fixed",f=getBoundingClientRect(t,!0,d,e);let g={scrollLeft:0,scrollTop:0};const b=createCoords(0);function _(){b.x=getWindowScrollBarX(l)}if(o||!o&&!d)if((getNodeName(e)!=="body"||isOverflowElement(l))&&(g=getNodeScroll(e)),o){const E=getBoundingClientRect(e,!0,d,e);b.x=E.x+e.clientLeft,b.y=E.y+e.clientTop}else l&&_();d&&!o&&l&&_();const S=l&&!o&&!d?getHTMLOffset(l,g):createCoords(0),R=f.left+g.scrollLeft-b.x-S.x,C=f.top+g.scrollTop-b.y-S.y;return{x:R,y:C,width:f.width,height:f.height}}function isStaticPositioned(t){return getComputedStyle$1(t).position==="static"}function getTrueOffsetParent(t,e){if(!isHTMLElement$2(t)||getComputedStyle$1(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return getDocumentElement(t)===n&&(n=n.ownerDocument.body),n}function getOffsetParent(t,e){const n=getWindow(t);if(isTopLayer(t))return n;if(!isHTMLElement$2(t)){let l=getParentNode(t);for(;l&&!isLastTraversableNode(l);){if(isElement(l)&&!isStaticPositioned(l))return l;l=getParentNode(l)}return n}let o=getTrueOffsetParent(t,e);for(;o&&isTableElement(o)&&isStaticPositioned(o);)o=getTrueOffsetParent(o,e);return o&&isLastTraversableNode(o)&&isStaticPositioned(o)&&!isContainingBlock(o)?n:o||getContainingBlock(t)||n}const getElementRects=async function(t){const e=this.getOffsetParent||getOffsetParent,n=this.getDimensions,o=await n(t.floating);return{reference:getRectRelativeToOffsetParent(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function isRTL(t){return getComputedStyle$1(t).direction==="rtl"}const platform={convertOffsetParentRelativeRectToViewportRelativeRect,getDocumentElement,getClippingRect,getOffsetParent,getElementRects,getClientRects,getDimensions,getScale,isElement,isRTL};function rectsAreEqual(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function observeMove(t,e){let n=null,o;const l=getDocumentElement(t);function d(){var g;clearTimeout(o),(g=n)==null||g.disconnect(),n=null}function f(g,b){g===void 0&&(g=!1),b===void 0&&(b=1),d();const _=t.getBoundingClientRect(),{left:S,top:R,width:C,height:E}=_;if(g||e(),!C||!E)return;const A=floor(R),I=floor(l.clientWidth-(S+C)),M=floor(l.clientHeight-(R+E)),j=floor(S),z={rootMargin:-A+"px "+-I+"px "+-M+"px "+-j+"px",threshold:max$3(0,min$3(1,b))||1};let Q=!0;function F(O){const te=O[0].intersectionRatio;if(te!==b){if(!Q)return f();te?f(!1,te):o=setTimeout(()=>{f(!1,1e-7)},1e3)}te===1&&!rectsAreEqual(_,t.getBoundingClientRect())&&f(),Q=!1}try{n=new IntersectionObserver(F,{...z,root:l.ownerDocument})}catch{n=new IntersectionObserver(F,z)}n.observe(t)}return f(!0),d}function autoUpdate(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:l=!0,ancestorResize:d=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:g=typeof IntersectionObserver=="function",animationFrame:b=!1}=o,_=unwrapElement(t),S=l||d?[..._?getOverflowAncestors(_):[],...getOverflowAncestors(e)]:[];S.forEach(j=>{l&&j.addEventListener("scroll",n,{passive:!0}),d&&j.addEventListener("resize",n)});const R=_&&g?observeMove(_,n):null;let C=-1,E=null;f&&(E=new ResizeObserver(j=>{let[q]=j;q&&q.target===_&&E&&(E.unobserve(e),cancelAnimationFrame(C),C=requestAnimationFrame(()=>{var z;(z=E)==null||z.observe(e)})),n()}),_&&!b&&E.observe(_),E.observe(e));let A,I=b?getBoundingClientRect(t):null;b&&M();function M(){const j=getBoundingClientRect(t);I&&!rectsAreEqual(I,j)&&n(),I=j,A=requestAnimationFrame(M)}return n(),()=>{var j;S.forEach(q=>{l&&q.removeEventListener("scroll",n),d&&q.removeEventListener("resize",n)}),R==null||R(),(j=E)==null||j.disconnect(),E=null,b&&cancelAnimationFrame(A)}}const offset$1=offset$2,shift$2=shift$3,flip$1=flip$2,size$1=size$2,hide$1=hide$2,arrow$3=arrow$4,limitShift$1=limitShift$2,computePosition=(t,e,n)=>{const o=new Map,l={platform,...n},d={...l.platform,_c:o};return computePosition$1(t,e,{...l,platform:d})};var isClient=typeof document<"u",noop$2=function(){},index=isClient?React.useLayoutEffect:noop$2;function deepEqual$3(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,o,l;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(o=n;o--!==0;)if(!deepEqual$3(t[o],e[o]))return!1;return!0}if(l=Object.keys(t),n=l.length,n!==Object.keys(e).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(e,l[o]))return!1;for(o=n;o--!==0;){const d=l[o];if(!(d==="_owner"&&t.$$typeof)&&!deepEqual$3(t[d],e[d]))return!1}return!0}return t!==t&&e!==e}function getDPR(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function roundByDPR(t,e){const n=getDPR(t);return Math.round(e*n)/n}function useLatestRef(t){const e=React__namespace.useRef(t);return index(()=>{e.current=t}),e}function useFloating(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:o=[],platform:l,elements:{reference:d,floating:f}={},transform:g=!0,whileElementsMounted:b,open:_}=t,[S,R]=React__namespace.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[C,E]=React__namespace.useState(o);deepEqual$3(C,o)||E(o);const[A,I]=React__namespace.useState(null),[M,j]=React__namespace.useState(null),q=React__namespace.useCallback(Ve=>{Ve!==O.current&&(O.current=Ve,I(Ve))},[]),z=React__namespace.useCallback(Ve=>{Ve!==te.current&&(te.current=Ve,j(Ve))},[]),Q=d||A,F=f||M,O=React__namespace.useRef(null),te=React__namespace.useRef(null),ne=React__namespace.useRef(S),ae=b!=null,ge=useLatestRef(b),oe=useLatestRef(l),je=useLatestRef(_),Ne=React__namespace.useCallback(()=>{if(!O.current||!te.current)return;const Ve={placement:e,strategy:n,middleware:C};oe.current&&(Ve.platform=oe.current),computePosition(O.current,te.current,Ve).then(Be=>{const qe={...Be,isPositioned:je.current!==!1};Ae.current&&!deepEqual$3(ne.current,qe)&&(ne.current=qe,ReactDOM__namespace.flushSync(()=>{R(qe)}))})},[C,e,n,oe,je]);index(()=>{_===!1&&ne.current.isPositioned&&(ne.current.isPositioned=!1,R(Ve=>({...Ve,isPositioned:!1})))},[_]);const Ae=React__namespace.useRef(!1);index(()=>(Ae.current=!0,()=>{Ae.current=!1}),[]),index(()=>{if(Q&&(O.current=Q),F&&(te.current=F),Q&&F){if(ge.current)return ge.current(Q,F,Ne);Ne()}},[Q,F,Ne,ge,ae]);const $e=React__namespace.useMemo(()=>({reference:O,floating:te,setReference:q,setFloating:z}),[q,z]),Fe=React__namespace.useMemo(()=>({reference:Q,floating:F}),[Q,F]),ze=React__namespace.useMemo(()=>{const Ve={position:n,left:0,top:0};if(!Fe.floating)return Ve;const Be=roundByDPR(Fe.floating,S.x),qe=roundByDPR(Fe.floating,S.y);return g?{...Ve,transform:"translate("+Be+"px, "+qe+"px)",...getDPR(Fe.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Be,top:qe}},[n,g,Fe.floating,S.x,S.y]);return React__namespace.useMemo(()=>({...S,update:Ne,refs:$e,elements:Fe,floatingStyles:ze}),[S,Ne,$e,Fe,ze])}const arrow$1=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:o,padding:l}=typeof t=="function"?t(n):t;return o&&e(o)?o.current!=null?arrow$3({element:o.current,padding:l}).fn(n):{}:o?arrow$3({element:o,padding:l}).fn(n):{}}}},offset=(t,e)=>({...offset$1(t),options:[t,e]}),shift$1=(t,e)=>({...shift$2(t),options:[t,e]}),limitShift=(t,e)=>({...limitShift$1(t),options:[t,e]}),flip=(t,e)=>({...flip$1(t),options:[t,e]}),size=(t,e)=>({...size$1(t),options:[t,e]}),hide=(t,e)=>({...hide$1(t),options:[t,e]}),arrow$2=(t,e)=>({...arrow$1(t),options:[t,e]});var NAME$3="Arrow",Arrow$1=React__namespace.forwardRef((t,e)=>{const{children:n,width:o=10,height:l=5,...d}=t;return jsxRuntime.jsx(Primitive.svg,{...d,ref:e,width:o,height:l,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:jsxRuntime.jsx("polygon",{points:"0,0 30,0 15,10"})})});Arrow$1.displayName=NAME$3;var Root$7=Arrow$1,POPPER_NAME="Popper",[createPopperContext,createPopperScope]=createContextScope(POPPER_NAME),[PopperProvider,usePopperContext]=createPopperContext(POPPER_NAME),Popper=t=>{const{__scopePopper:e,children:n}=t,[o,l]=React__namespace.useState(null);return jsxRuntime.jsx(PopperProvider,{scope:e,anchor:o,onAnchorChange:l,children:n})};Popper.displayName=POPPER_NAME;var ANCHOR_NAME$2="PopperAnchor",PopperAnchor=React__namespace.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:o,...l}=t,d=usePopperContext(ANCHOR_NAME$2,n),f=React__namespace.useRef(null),g=useComposedRefs(e,f);return React__namespace.useEffect(()=>{d.onAnchorChange((o==null?void 0:o.current)||f.current)}),o?null:jsxRuntime.jsx(Primitive.div,{...l,ref:g})});PopperAnchor.displayName=ANCHOR_NAME$2;var CONTENT_NAME$7="PopperContent",[PopperContentProvider,useContentContext]=createPopperContext(CONTENT_NAME$7),PopperContent=React__namespace.forwardRef((t,e)=>{var Ze,at,rt,it,st,Ue;const{__scopePopper:n,side:o="bottom",sideOffset:l=0,align:d="center",alignOffset:f=0,arrowPadding:g=0,avoidCollisions:b=!0,collisionBoundary:_=[],collisionPadding:S=0,sticky:R="partial",hideWhenDetached:C=!1,updatePositionStrategy:E="optimized",onPlaced:A,...I}=t,M=usePopperContext(CONTENT_NAME$7,n),[j,q]=React__namespace.useState(null),z=useComposedRefs(e,Rt=>q(Rt)),[Q,F]=React__namespace.useState(null),O=useSize(Q),te=(O==null?void 0:O.width)??0,ne=(O==null?void 0:O.height)??0,ae=o+(d!=="center"?"-"+d:""),ge=typeof S=="number"?S:{top:0,right:0,bottom:0,left:0,...S},oe=Array.isArray(_)?_:[_],je=oe.length>0,Ne={padding:ge,boundary:oe.filter(isNotNull),altBoundary:je},{refs:Ae,floatingStyles:$e,placement:Fe,isPositioned:ze,middlewareData:Ve}=useFloating({strategy:"fixed",placement:ae,whileElementsMounted:(...Rt)=>autoUpdate(...Rt,{animationFrame:E==="always"}),elements:{reference:M.anchor},middleware:[offset({mainAxis:l+ne,alignmentAxis:f}),b&&shift$1({mainAxis:!0,crossAxis:!1,limiter:R==="partial"?limitShift():void 0,...Ne}),b&&flip({...Ne}),size({...Ne,apply:({elements:Rt,rects:Je,availableWidth:mt,availableHeight:$t})=>{const{width:Dt,height:Ht}=Je.reference,Vt=Rt.floating.style;Vt.setProperty("--radix-popper-available-width",`${mt}px`),Vt.setProperty("--radix-popper-available-height",`${$t}px`),Vt.setProperty("--radix-popper-anchor-width",`${Dt}px`),Vt.setProperty("--radix-popper-anchor-height",`${Ht}px`)}}),Q&&arrow$2({element:Q,padding:g}),transformOrigin({arrowWidth:te,arrowHeight:ne}),C&&hide({strategy:"referenceHidden",...Ne})]}),[Be,qe]=getSideAndAlignFromPlacement(Fe),Ke=useCallbackRef$1(A);useLayoutEffect2(()=>{ze&&(Ke==null||Ke())},[ze,Ke]);const He=(Ze=Ve.arrow)==null?void 0:Ze.x,Xe=(at=Ve.arrow)==null?void 0:at.y,tt=((rt=Ve.arrow)==null?void 0:rt.centerOffset)!==0,[Ye,et]=React__namespace.useState();return useLayoutEffect2(()=>{j&&et(window.getComputedStyle(j).zIndex)},[j]),jsxRuntime.jsx("div",{ref:Ae.setFloating,"data-radix-popper-content-wrapper":"",style:{...$e,transform:ze?$e.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ye,"--radix-popper-transform-origin":[(it=Ve.transformOrigin)==null?void 0:it.x,(st=Ve.transformOrigin)==null?void 0:st.y].join(" "),...((Ue=Ve.hide)==null?void 0:Ue.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:jsxRuntime.jsx(PopperContentProvider,{scope:n,placedSide:Be,onArrowChange:F,arrowX:He,arrowY:Xe,shouldHideArrow:tt,children:jsxRuntime.jsx(Primitive.div,{"data-side":Be,"data-align":qe,...I,ref:z,style:{...I.style,animation:ze?void 0:"none"}})})})});PopperContent.displayName=CONTENT_NAME$7;var ARROW_NAME$5="PopperArrow",OPPOSITE_SIDE={top:"bottom",right:"left",bottom:"top",left:"right"},PopperArrow=React__namespace.forwardRef(function(e,n){const{__scopePopper:o,...l}=e,d=useContentContext(ARROW_NAME$5,o),f=OPPOSITE_SIDE[d.placedSide];return jsxRuntime.jsx("span",{ref:d.onArrowChange,style:{position:"absolute",left:d.arrowX,top:d.arrowY,[f]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[d.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[d.placedSide],visibility:d.shouldHideArrow?"hidden":void 0},children:jsxRuntime.jsx(Root$7,{...l,ref:n,style:{...l.style,display:"block"}})})});PopperArrow.displayName=ARROW_NAME$5;function isNotNull(t){return t!==null}var transformOrigin=t=>({name:"transformOrigin",options:t,fn(e){var M,j,q;const{placement:n,rects:o,middlewareData:l}=e,f=((M=l.arrow)==null?void 0:M.centerOffset)!==0,g=f?0:t.arrowWidth,b=f?0:t.arrowHeight,[_,S]=getSideAndAlignFromPlacement(n),R={start:"0%",center:"50%",end:"100%"}[S],C=(((j=l.arrow)==null?void 0:j.x)??0)+g/2,E=(((q=l.arrow)==null?void 0:q.y)??0)+b/2;let A="",I="";return _==="bottom"?(A=f?R:`${C}px`,I=`${-b}px`):_==="top"?(A=f?R:`${C}px`,I=`${o.floating.height+b}px`):_==="right"?(A=`${-b}px`,I=f?R:`${E}px`):_==="left"&&(A=`${o.floating.width+b}px`,I=f?R:`${E}px`),{data:{x:A,y:I}}}});function getSideAndAlignFromPlacement(t){const[e,n="center"]=t.split("-");return[e,n]}var Root2$6=Popper,Anchor=PopperAnchor,Content$1=PopperContent,Arrow=PopperArrow,SELECTION_KEYS$1=["Enter"," "],FIRST_KEYS=["ArrowDown","PageUp","Home"],LAST_KEYS=["ArrowUp","PageDown","End"],FIRST_LAST_KEYS=[...FIRST_KEYS,...LAST_KEYS],SUB_OPEN_KEYS={ltr:[...SELECTION_KEYS$1,"ArrowRight"],rtl:[...SELECTION_KEYS$1,"ArrowLeft"]},SUB_CLOSE_KEYS={ltr:["ArrowLeft"],rtl:["ArrowRight"]},MENU_NAME="Menu",[Collection$2,useCollection$2,createCollectionScope$2]=createCollection(MENU_NAME),[createMenuContext,createMenuScope]=createContextScope(MENU_NAME,[createCollectionScope$2,createPopperScope,createRovingFocusGroupScope]),usePopperScope$3=createPopperScope(),useRovingFocusGroupScope$1=createRovingFocusGroupScope(),[MenuProvider,useMenuContext]=createMenuContext(MENU_NAME),[MenuRootProvider,useMenuRootContext]=createMenuContext(MENU_NAME),Menu=t=>{const{__scopeMenu:e,open:n=!1,children:o,dir:l,onOpenChange:d,modal:f=!0}=t,g=usePopperScope$3(e),[b,_]=React__namespace.useState(null),S=React__namespace.useRef(!1),R=useCallbackRef$1(d),C=useDirection(l);return React__namespace.useEffect(()=>{const E=()=>{S.current=!0,document.addEventListener("pointerdown",A,{capture:!0,once:!0}),document.addEventListener("pointermove",A,{capture:!0,once:!0})},A=()=>S.current=!1;return document.addEventListener("keydown",E,{capture:!0}),()=>{document.removeEventListener("keydown",E,{capture:!0}),document.removeEventListener("pointerdown",A,{capture:!0}),document.removeEventListener("pointermove",A,{capture:!0})}},[]),jsxRuntime.jsx(Root2$6,{...g,children:jsxRuntime.jsx(MenuProvider,{scope:e,open:n,onOpenChange:R,content:b,onContentChange:_,children:jsxRuntime.jsx(MenuRootProvider,{scope:e,onClose:React__namespace.useCallback(()=>R(!1),[R]),isUsingKeyboardRef:S,dir:C,modal:f,children:o})})})};Menu.displayName=MENU_NAME;var ANCHOR_NAME$1="MenuAnchor",MenuAnchor=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,...o}=t,l=usePopperScope$3(n);return jsxRuntime.jsx(Anchor,{...l,...o,ref:e})});MenuAnchor.displayName=ANCHOR_NAME$1;var PORTAL_NAME$5="MenuPortal",[PortalProvider$2,usePortalContext$2]=createMenuContext(PORTAL_NAME$5,{forceMount:void 0}),MenuPortal=t=>{const{__scopeMenu:e,forceMount:n,children:o,container:l}=t,d=useMenuContext(PORTAL_NAME$5,e);return jsxRuntime.jsx(PortalProvider$2,{scope:e,forceMount:n,children:jsxRuntime.jsx(Presence,{present:n||d.open,children:jsxRuntime.jsx(Portal$5,{asChild:!0,container:l,children:o})})})};MenuPortal.displayName=PORTAL_NAME$5;var CONTENT_NAME$6="MenuContent",[MenuContentProvider,useMenuContentContext]=createMenuContext(CONTENT_NAME$6),MenuContent=React__namespace.forwardRef((t,e)=>{const n=usePortalContext$2(CONTENT_NAME$6,t.__scopeMenu),{forceMount:o=n.forceMount,...l}=t,d=useMenuContext(CONTENT_NAME$6,t.__scopeMenu),f=useMenuRootContext(CONTENT_NAME$6,t.__scopeMenu);return jsxRuntime.jsx(Collection$2.Provider,{scope:t.__scopeMenu,children:jsxRuntime.jsx(Presence,{present:o||d.open,children:jsxRuntime.jsx(Collection$2.Slot,{scope:t.__scopeMenu,children:f.modal?jsxRuntime.jsx(MenuRootContentModal,{...l,ref:e}):jsxRuntime.jsx(MenuRootContentNonModal,{...l,ref:e})})})})}),MenuRootContentModal=React__namespace.forwardRef((t,e)=>{const n=useMenuContext(CONTENT_NAME$6,t.__scopeMenu),o=React__namespace.useRef(null),l=useComposedRefs(e,o);return React__namespace.useEffect(()=>{const d=o.current;if(d)return hideOthers(d)},[]),jsxRuntime.jsx(MenuContentImpl,{...t,ref:l,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:composeEventHandlers(t.onFocusOutside,d=>d.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),MenuRootContentNonModal=React__namespace.forwardRef((t,e)=>{const n=useMenuContext(CONTENT_NAME$6,t.__scopeMenu);return jsxRuntime.jsx(MenuContentImpl,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Slot$2=createSlot("MenuContent.ScrollLock"),MenuContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,loop:o=!1,trapFocus:l,onOpenAutoFocus:d,onCloseAutoFocus:f,disableOutsidePointerEvents:g,onEntryFocus:b,onEscapeKeyDown:_,onPointerDownOutside:S,onFocusOutside:R,onInteractOutside:C,onDismiss:E,disableOutsideScroll:A,...I}=t,M=useMenuContext(CONTENT_NAME$6,n),j=useMenuRootContext(CONTENT_NAME$6,n),q=usePopperScope$3(n),z=useRovingFocusGroupScope$1(n),Q=useCollection$2(n),[F,O]=React__namespace.useState(null),te=React__namespace.useRef(null),ne=useComposedRefs(e,te,M.onContentChange),ae=React__namespace.useRef(0),ge=React__namespace.useRef(""),oe=React__namespace.useRef(0),je=React__namespace.useRef(null),Ne=React__namespace.useRef("right"),Ae=React__namespace.useRef(0),$e=A?ReactRemoveScroll:React__namespace.Fragment,Fe=A?{as:Slot$2,allowPinchZoom:!0}:void 0,ze=Be=>{var Ze,at;const qe=ge.current+Be,Ke=Q().filter(rt=>!rt.disabled),He=document.activeElement,Xe=(Ze=Ke.find(rt=>rt.ref.current===He))==null?void 0:Ze.textValue,tt=Ke.map(rt=>rt.textValue),Ye=getNextMatch(tt,qe,Xe),et=(at=Ke.find(rt=>rt.textValue===Ye))==null?void 0:at.ref.current;(function rt(it){ge.current=it,window.clearTimeout(ae.current),it!==""&&(ae.current=window.setTimeout(()=>rt(""),1e3))})(qe),et&&setTimeout(()=>et.focus())};React__namespace.useEffect(()=>()=>window.clearTimeout(ae.current),[]),useFocusGuards();const Ve=React__namespace.useCallback(Be=>{var Ke,He;return Ne.current===((Ke=je.current)==null?void 0:Ke.side)&&isPointerInGraceArea(Be,(He=je.current)==null?void 0:He.area)},[]);return jsxRuntime.jsx(MenuContentProvider,{scope:n,searchRef:ge,onItemEnter:React__namespace.useCallback(Be=>{Ve(Be)&&Be.preventDefault()},[Ve]),onItemLeave:React__namespace.useCallback(Be=>{var qe;Ve(Be)||((qe=te.current)==null||qe.focus(),O(null))},[Ve]),onTriggerLeave:React__namespace.useCallback(Be=>{Ve(Be)&&Be.preventDefault()},[Ve]),pointerGraceTimerRef:oe,onPointerGraceIntentChange:React__namespace.useCallback(Be=>{je.current=Be},[]),children:jsxRuntime.jsx($e,{...Fe,children:jsxRuntime.jsx(FocusScope,{asChild:!0,trapped:l,onMountAutoFocus:composeEventHandlers(d,Be=>{var qe;Be.preventDefault(),(qe=te.current)==null||qe.focus({preventScroll:!0})}),onUnmountAutoFocus:f,children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:g,onEscapeKeyDown:_,onPointerDownOutside:S,onFocusOutside:R,onInteractOutside:C,onDismiss:E,children:jsxRuntime.jsx(Root$a,{asChild:!0,...z,dir:j.dir,orientation:"vertical",loop:o,currentTabStopId:F,onCurrentTabStopIdChange:O,onEntryFocus:composeEventHandlers(b,Be=>{j.isUsingKeyboardRef.current||Be.preventDefault()}),preventScrollOnEntryFocus:!0,children:jsxRuntime.jsx(Content$1,{role:"menu","aria-orientation":"vertical","data-state":getOpenState(M.open),"data-radix-menu-content":"",dir:j.dir,...q,...I,ref:ne,style:{outline:"none",...I.style},onKeyDown:composeEventHandlers(I.onKeyDown,Be=>{const Ke=Be.target.closest("[data-radix-menu-content]")===Be.currentTarget,He=Be.ctrlKey||Be.altKey||Be.metaKey,Xe=Be.key.length===1;Ke&&(Be.key==="Tab"&&Be.preventDefault(),!He&&Xe&&ze(Be.key));const tt=te.current;if(Be.target!==tt||!FIRST_LAST_KEYS.includes(Be.key))return;Be.preventDefault();const et=Q().filter(Ze=>!Ze.disabled).map(Ze=>Ze.ref.current);LAST_KEYS.includes(Be.key)&&et.reverse(),focusFirst$1(et)}),onBlur:composeEventHandlers(t.onBlur,Be=>{Be.currentTarget.contains(Be.target)||(window.clearTimeout(ae.current),ge.current="")}),onPointerMove:composeEventHandlers(t.onPointerMove,whenMouse(Be=>{const qe=Be.target,Ke=Ae.current!==Be.clientX;if(Be.currentTarget.contains(qe)&&Ke){const He=Be.clientX>Ae.current?"right":"left";Ne.current=He,Ae.current=Be.clientX}}))})})})})})})});MenuContent.displayName=CONTENT_NAME$6;var GROUP_NAME$2="MenuGroup",MenuGroup=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,...o}=t;return jsxRuntime.jsx(Primitive.div,{role:"group",...o,ref:e})});MenuGroup.displayName=GROUP_NAME$2;var LABEL_NAME$2="MenuLabel",MenuLabel=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,...o}=t;return jsxRuntime.jsx(Primitive.div,{...o,ref:e})});MenuLabel.displayName=LABEL_NAME$2;var ITEM_NAME$2="MenuItem",ITEM_SELECT="menu.itemSelect",MenuItem=React__namespace.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:o,...l}=t,d=React__namespace.useRef(null),f=useMenuRootContext(ITEM_NAME$2,t.__scopeMenu),g=useMenuContentContext(ITEM_NAME$2,t.__scopeMenu),b=useComposedRefs(e,d),_=React__namespace.useRef(!1),S=()=>{const R=d.current;if(!n&&R){const C=new CustomEvent(ITEM_SELECT,{bubbles:!0,cancelable:!0});R.addEventListener(ITEM_SELECT,E=>o==null?void 0:o(E),{once:!0}),dispatchDiscreteCustomEvent(R,C),C.defaultPrevented?_.current=!1:f.onClose()}};return jsxRuntime.jsx(MenuItemImpl,{...l,ref:b,disabled:n,onClick:composeEventHandlers(t.onClick,S),onPointerDown:R=>{var C;(C=t.onPointerDown)==null||C.call(t,R),_.current=!0},onPointerUp:composeEventHandlers(t.onPointerUp,R=>{var C;_.current||(C=R.currentTarget)==null||C.click()}),onKeyDown:composeEventHandlers(t.onKeyDown,R=>{const C=g.searchRef.current!=="";n||C&&R.key===" "||SELECTION_KEYS$1.includes(R.key)&&(R.currentTarget.click(),R.preventDefault())})})});MenuItem.displayName=ITEM_NAME$2;var MenuItemImpl=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:o=!1,textValue:l,...d}=t,f=useMenuContentContext(ITEM_NAME$2,n),g=useRovingFocusGroupScope$1(n),b=React__namespace.useRef(null),_=useComposedRefs(e,b),[S,R]=React__namespace.useState(!1),[C,E]=React__namespace.useState("");return React__namespace.useEffect(()=>{const A=b.current;A&&E((A.textContent??"").trim())},[d.children]),jsxRuntime.jsx(Collection$2.ItemSlot,{scope:n,disabled:o,textValue:l??C,children:jsxRuntime.jsx(Item$2,{asChild:!0,...g,focusable:!o,children:jsxRuntime.jsx(Primitive.div,{role:"menuitem","data-highlighted":S?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...d,ref:_,onPointerMove:composeEventHandlers(t.onPointerMove,whenMouse(A=>{o?f.onItemLeave(A):(f.onItemEnter(A),A.defaultPrevented||A.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:composeEventHandlers(t.onPointerLeave,whenMouse(A=>f.onItemLeave(A))),onFocus:composeEventHandlers(t.onFocus,()=>R(!0)),onBlur:composeEventHandlers(t.onBlur,()=>R(!1))})})})}),CHECKBOX_ITEM_NAME$1="MenuCheckboxItem",MenuCheckboxItem=React__namespace.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:o,...l}=t;return jsxRuntime.jsx(ItemIndicatorProvider,{scope:t.__scopeMenu,checked:n,children:jsxRuntime.jsx(MenuItem,{role:"menuitemcheckbox","aria-checked":isIndeterminate$1(n)?"mixed":n,...l,ref:e,"data-state":getCheckedState(n),onSelect:composeEventHandlers(l.onSelect,()=>o==null?void 0:o(isIndeterminate$1(n)?!0:!n),{checkForDefaultPrevented:!1})})})});MenuCheckboxItem.displayName=CHECKBOX_ITEM_NAME$1;var RADIO_GROUP_NAME$1="MenuRadioGroup",[RadioGroupProvider,useRadioGroupContext]=createMenuContext(RADIO_GROUP_NAME$1,{value:void 0,onValueChange:()=>{}}),MenuRadioGroup=React__namespace.forwardRef((t,e)=>{const{value:n,onValueChange:o,...l}=t,d=useCallbackRef$1(o);return jsxRuntime.jsx(RadioGroupProvider,{scope:t.__scopeMenu,value:n,onValueChange:d,children:jsxRuntime.jsx(MenuGroup,{...l,ref:e})})});MenuRadioGroup.displayName=RADIO_GROUP_NAME$1;var RADIO_ITEM_NAME$1="MenuRadioItem",MenuRadioItem=React__namespace.forwardRef((t,e)=>{const{value:n,...o}=t,l=useRadioGroupContext(RADIO_ITEM_NAME$1,t.__scopeMenu),d=n===l.value;return jsxRuntime.jsx(ItemIndicatorProvider,{scope:t.__scopeMenu,checked:d,children:jsxRuntime.jsx(MenuItem,{role:"menuitemradio","aria-checked":d,...o,ref:e,"data-state":getCheckedState(d),onSelect:composeEventHandlers(o.onSelect,()=>{var f;return(f=l.onValueChange)==null?void 0:f.call(l,n)},{checkForDefaultPrevented:!1})})})});MenuRadioItem.displayName=RADIO_ITEM_NAME$1;var ITEM_INDICATOR_NAME$1="MenuItemIndicator",[ItemIndicatorProvider,useItemIndicatorContext]=createMenuContext(ITEM_INDICATOR_NAME$1,{checked:!1}),MenuItemIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:o,...l}=t,d=useItemIndicatorContext(ITEM_INDICATOR_NAME$1,n);return jsxRuntime.jsx(Presence,{present:o||isIndeterminate$1(d.checked)||d.checked===!0,children:jsxRuntime.jsx(Primitive.span,{...l,ref:e,"data-state":getCheckedState(d.checked)})})});MenuItemIndicator.displayName=ITEM_INDICATOR_NAME$1;var SEPARATOR_NAME$2="MenuSeparator",MenuSeparator=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,...o}=t;return jsxRuntime.jsx(Primitive.div,{role:"separator","aria-orientation":"horizontal",...o,ref:e})});MenuSeparator.displayName=SEPARATOR_NAME$2;var ARROW_NAME$4="MenuArrow",MenuArrow=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,...o}=t,l=usePopperScope$3(n);return jsxRuntime.jsx(Arrow,{...l,...o,ref:e})});MenuArrow.displayName=ARROW_NAME$4;var SUB_NAME="MenuSub",[MenuSubProvider,useMenuSubContext]=createMenuContext(SUB_NAME),MenuSub=t=>{const{__scopeMenu:e,children:n,open:o=!1,onOpenChange:l}=t,d=useMenuContext(SUB_NAME,e),f=usePopperScope$3(e),[g,b]=React__namespace.useState(null),[_,S]=React__namespace.useState(null),R=useCallbackRef$1(l);return React__namespace.useEffect(()=>(d.open===!1&&R(!1),()=>R(!1)),[d.open,R]),jsxRuntime.jsx(Root2$6,{...f,children:jsxRuntime.jsx(MenuProvider,{scope:e,open:o,onOpenChange:R,content:_,onContentChange:S,children:jsxRuntime.jsx(MenuSubProvider,{scope:e,contentId:useId(),triggerId:useId(),trigger:g,onTriggerChange:b,children:n})})})};MenuSub.displayName=SUB_NAME;var SUB_TRIGGER_NAME$1="MenuSubTrigger",MenuSubTrigger=React__namespace.forwardRef((t,e)=>{const n=useMenuContext(SUB_TRIGGER_NAME$1,t.__scopeMenu),o=useMenuRootContext(SUB_TRIGGER_NAME$1,t.__scopeMenu),l=useMenuSubContext(SUB_TRIGGER_NAME$1,t.__scopeMenu),d=useMenuContentContext(SUB_TRIGGER_NAME$1,t.__scopeMenu),f=React__namespace.useRef(null),{pointerGraceTimerRef:g,onPointerGraceIntentChange:b}=d,_={__scopeMenu:t.__scopeMenu},S=React__namespace.useCallback(()=>{f.current&&window.clearTimeout(f.current),f.current=null},[]);return React__namespace.useEffect(()=>S,[S]),React__namespace.useEffect(()=>{const R=g.current;return()=>{window.clearTimeout(R),b(null)}},[g,b]),jsxRuntime.jsx(MenuAnchor,{asChild:!0,..._,children:jsxRuntime.jsx(MenuItemImpl,{id:l.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":l.contentId,"data-state":getOpenState(n.open),...t,ref:composeRefs(e,l.onTriggerChange),onClick:R=>{var C;(C=t.onClick)==null||C.call(t,R),!(t.disabled||R.defaultPrevented)&&(R.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:composeEventHandlers(t.onPointerMove,whenMouse(R=>{d.onItemEnter(R),!R.defaultPrevented&&!t.disabled&&!n.open&&!f.current&&(d.onPointerGraceIntentChange(null),f.current=window.setTimeout(()=>{n.onOpenChange(!0),S()},100))})),onPointerLeave:composeEventHandlers(t.onPointerLeave,whenMouse(R=>{var E,A;S();const C=(E=n.content)==null?void 0:E.getBoundingClientRect();if(C){const I=(A=n.content)==null?void 0:A.dataset.side,M=I==="right",j=M?-5:5,q=C[M?"left":"right"],z=C[M?"right":"left"];d.onPointerGraceIntentChange({area:[{x:R.clientX+j,y:R.clientY},{x:q,y:C.top},{x:z,y:C.top},{x:z,y:C.bottom},{x:q,y:C.bottom}],side:I}),window.clearTimeout(g.current),g.current=window.setTimeout(()=>d.onPointerGraceIntentChange(null),300)}else{if(d.onTriggerLeave(R),R.defaultPrevented)return;d.onPointerGraceIntentChange(null)}})),onKeyDown:composeEventHandlers(t.onKeyDown,R=>{var E;const C=d.searchRef.current!=="";t.disabled||C&&R.key===" "||SUB_OPEN_KEYS[o.dir].includes(R.key)&&(n.onOpenChange(!0),(E=n.content)==null||E.focus(),R.preventDefault())})})})});MenuSubTrigger.displayName=SUB_TRIGGER_NAME$1;var SUB_CONTENT_NAME$1="MenuSubContent",MenuSubContent=React__namespace.forwardRef((t,e)=>{const n=usePortalContext$2(CONTENT_NAME$6,t.__scopeMenu),{forceMount:o=n.forceMount,...l}=t,d=useMenuContext(CONTENT_NAME$6,t.__scopeMenu),f=useMenuRootContext(CONTENT_NAME$6,t.__scopeMenu),g=useMenuSubContext(SUB_CONTENT_NAME$1,t.__scopeMenu),b=React__namespace.useRef(null),_=useComposedRefs(e,b);return jsxRuntime.jsx(Collection$2.Provider,{scope:t.__scopeMenu,children:jsxRuntime.jsx(Presence,{present:o||d.open,children:jsxRuntime.jsx(Collection$2.Slot,{scope:t.__scopeMenu,children:jsxRuntime.jsx(MenuContentImpl,{id:g.contentId,"aria-labelledby":g.triggerId,...l,ref:_,align:"start",side:f.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:S=>{var R;f.isUsingKeyboardRef.current&&((R=b.current)==null||R.focus()),S.preventDefault()},onCloseAutoFocus:S=>S.preventDefault(),onFocusOutside:composeEventHandlers(t.onFocusOutside,S=>{S.target!==g.trigger&&d.onOpenChange(!1)}),onEscapeKeyDown:composeEventHandlers(t.onEscapeKeyDown,S=>{f.onClose(),S.preventDefault()}),onKeyDown:composeEventHandlers(t.onKeyDown,S=>{var E;const R=S.currentTarget.contains(S.target),C=SUB_CLOSE_KEYS[f.dir].includes(S.key);R&&C&&(d.onOpenChange(!1),(E=g.trigger)==null||E.focus(),S.preventDefault())})})})})})});MenuSubContent.displayName=SUB_CONTENT_NAME$1;function getOpenState(t){return t?"open":"closed"}function isIndeterminate$1(t){return t==="indeterminate"}function getCheckedState(t){return isIndeterminate$1(t)?"indeterminate":t?"checked":"unchecked"}function focusFirst$1(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function wrapArray$1(t,e){return t.map((n,o)=>t[(e+o)%t.length])}function getNextMatch(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$1(t,Math.max(d,0));l.length===1&&(f=f.filter(_=>_!==n));const b=f.find(_=>_.toLowerCase().startsWith(l.toLowerCase()));return b!==n?b:void 0}function isPointInPolygon$1(t,e){const{x:n,y:o}=t;let l=!1;for(let d=0,f=e.length-1;d<e.length;f=d++){const g=e[d],b=e[f],_=g.x,S=g.y,R=b.x,C=b.y;S>o!=C>o&&n<(R-_)*(o-S)/(C-S)+_&&(l=!l)}return l}function isPointerInGraceArea(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return isPointInPolygon$1(n,e)}function whenMouse(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Root3$1=Menu,Anchor2$1=MenuAnchor,Portal$3=MenuPortal,Content2$5=MenuContent,Group$1=MenuGroup,Label$4=MenuLabel,Item2$1=MenuItem,CheckboxItem=MenuCheckboxItem,RadioGroup=MenuRadioGroup,RadioItem=MenuRadioItem,ItemIndicator$1=MenuItemIndicator,Separator$3=MenuSeparator,Arrow2=MenuArrow,Sub=MenuSub,SubTrigger=MenuSubTrigger,SubContent=MenuSubContent,DROPDOWN_MENU_NAME="DropdownMenu",[createDropdownMenuContext,createDropdownMenuScope]=createContextScope(DROPDOWN_MENU_NAME,[createMenuScope]),useMenuScope=createMenuScope(),[DropdownMenuProvider,useDropdownMenuContext]=createDropdownMenuContext(DROPDOWN_MENU_NAME),DropdownMenu$1=t=>{const{__scopeDropdownMenu:e,children:n,dir:o,open:l,defaultOpen:d,onOpenChange:f,modal:g=!0}=t,b=useMenuScope(e),_=React__namespace.useRef(null),[S,R]=useControllableState({prop:l,defaultProp:d??!1,onChange:f,caller:DROPDOWN_MENU_NAME});return jsxRuntime.jsx(DropdownMenuProvider,{scope:e,triggerId:useId(),triggerRef:_,contentId:useId(),open:S,onOpenChange:R,onOpenToggle:React__namespace.useCallback(()=>R(C=>!C),[R]),modal:g,children:jsxRuntime.jsx(Root3$1,{...b,open:S,onOpenChange:R,dir:o,modal:g,children:n})})};DropdownMenu$1.displayName=DROPDOWN_MENU_NAME;var TRIGGER_NAME$6="DropdownMenuTrigger",DropdownMenuTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:o=!1,...l}=t,d=useDropdownMenuContext(TRIGGER_NAME$6,n),f=useMenuScope(n);return jsxRuntime.jsx(Anchor2$1,{asChild:!0,...f,children:jsxRuntime.jsx(Primitive.button,{type:"button",id:d.triggerId,"aria-haspopup":"menu","aria-expanded":d.open,"aria-controls":d.open?d.contentId:void 0,"data-state":d.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...l,ref:composeRefs(e,d.triggerRef),onPointerDown:composeEventHandlers(t.onPointerDown,g=>{!o&&g.button===0&&g.ctrlKey===!1&&(d.onOpenToggle(),d.open||g.preventDefault())}),onKeyDown:composeEventHandlers(t.onKeyDown,g=>{o||(["Enter"," "].includes(g.key)&&d.onOpenToggle(),g.key==="ArrowDown"&&d.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(g.key)&&g.preventDefault())})})})});DropdownMenuTrigger$1.displayName=TRIGGER_NAME$6;var PORTAL_NAME$4="DropdownMenuPortal",DropdownMenuPortal$1=t=>{const{__scopeDropdownMenu:e,...n}=t,o=useMenuScope(e);return jsxRuntime.jsx(Portal$3,{...o,...n})};DropdownMenuPortal$1.displayName=PORTAL_NAME$4;var CONTENT_NAME$5="DropdownMenuContent",DropdownMenuContent$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useDropdownMenuContext(CONTENT_NAME$5,n),d=useMenuScope(n),f=React__namespace.useRef(!1);return jsxRuntime.jsx(Content2$5,{id:l.contentId,"aria-labelledby":l.triggerId,...d,...o,ref:e,onCloseAutoFocus:composeEventHandlers(t.onCloseAutoFocus,g=>{var b;f.current||(b=l.triggerRef.current)==null||b.focus(),f.current=!1,g.preventDefault()}),onInteractOutside:composeEventHandlers(t.onInteractOutside,g=>{const b=g.detail.originalEvent,_=b.button===0&&b.ctrlKey===!0,S=b.button===2||_;(!l.modal||S)&&(f.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});DropdownMenuContent$1.displayName=CONTENT_NAME$5;var GROUP_NAME$1="DropdownMenuGroup",DropdownMenuGroup$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(Group$1,{...l,...o,ref:e})});DropdownMenuGroup$1.displayName=GROUP_NAME$1;var LABEL_NAME$1="DropdownMenuLabel",DropdownMenuLabel$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(Label$4,{...l,...o,ref:e})});DropdownMenuLabel$1.displayName=LABEL_NAME$1;var ITEM_NAME$1="DropdownMenuItem",DropdownMenuItem$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(Item2$1,{...l,...o,ref:e})});DropdownMenuItem$1.displayName=ITEM_NAME$1;var CHECKBOX_ITEM_NAME="DropdownMenuCheckboxItem",DropdownMenuCheckboxItem$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(CheckboxItem,{...l,...o,ref:e})});DropdownMenuCheckboxItem$1.displayName=CHECKBOX_ITEM_NAME;var RADIO_GROUP_NAME="DropdownMenuRadioGroup",DropdownMenuRadioGroup$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(RadioGroup,{...l,...o,ref:e})});DropdownMenuRadioGroup$1.displayName=RADIO_GROUP_NAME;var RADIO_ITEM_NAME="DropdownMenuRadioItem",DropdownMenuRadioItem$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(RadioItem,{...l,...o,ref:e})});DropdownMenuRadioItem$1.displayName=RADIO_ITEM_NAME;var INDICATOR_NAME$2="DropdownMenuItemIndicator",DropdownMenuItemIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(ItemIndicator$1,{...l,...o,ref:e})});DropdownMenuItemIndicator.displayName=INDICATOR_NAME$2;var SEPARATOR_NAME$1="DropdownMenuSeparator",DropdownMenuSeparator$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(Separator$3,{...l,...o,ref:e})});DropdownMenuSeparator$1.displayName=SEPARATOR_NAME$1;var ARROW_NAME$3="DropdownMenuArrow",DropdownMenuArrow=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(Arrow2,{...l,...o,ref:e})});DropdownMenuArrow.displayName=ARROW_NAME$3;var DropdownMenuSub$1=t=>{const{__scopeDropdownMenu:e,children:n,open:o,onOpenChange:l,defaultOpen:d}=t,f=useMenuScope(e),[g,b]=useControllableState({prop:o,defaultProp:d??!1,onChange:l,caller:"DropdownMenuSub"});return jsxRuntime.jsx(Sub,{...f,open:g,onOpenChange:b,children:n})},SUB_TRIGGER_NAME="DropdownMenuSubTrigger",DropdownMenuSubTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(SubTrigger,{...l,...o,ref:e})});DropdownMenuSubTrigger$1.displayName=SUB_TRIGGER_NAME;var SUB_CONTENT_NAME="DropdownMenuSubContent",DropdownMenuSubContent$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(SubContent,{...l,...o,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});DropdownMenuSubContent$1.displayName=SUB_CONTENT_NAME;var Root2$5=DropdownMenu$1,Trigger$4=DropdownMenuTrigger$1,Portal2$1=DropdownMenuPortal$1,Content2$4=DropdownMenuContent$1,Group2=DropdownMenuGroup$1,Label2=DropdownMenuLabel$1,Item2=DropdownMenuItem$1,CheckboxItem2=DropdownMenuCheckboxItem$1,RadioGroup2=DropdownMenuRadioGroup$1,RadioItem2=DropdownMenuRadioItem$1,ItemIndicator2=DropdownMenuItemIndicator,Separator2=DropdownMenuSeparator$1,Sub2=DropdownMenuSub$1,SubTrigger2=DropdownMenuSubTrigger$1,SubContent2=DropdownMenuSubContent$1;const DropdownMenu=Root2$5,DropdownMenuTrigger=Trigger$4,DropdownMenuGroup=Group2,DropdownMenuPortal=Portal2$1,DropdownMenuSub=Sub2,DropdownMenuRadioGroup=RadioGroup2,DropdownMenuSubTrigger=React__namespace.forwardRef(({className:t,inset:e,children:n,...o},l)=>jsxRuntime.jsxs(SubTrigger2,{ref:l,className:cn("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e&&"pl-8",t),...o,children:[n,jsxRuntime.jsx(ChevronRight,{className:"ml-auto"})]}));DropdownMenuSubTrigger.displayName=SubTrigger2.displayName;const DropdownMenuSubContent=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(SubContent2,{ref:n,className:cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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-dropdown-menu-content-transform-origin]",t),...e}));DropdownMenuSubContent.displayName=SubContent2.displayName;const DropdownMenuContent=React__namespace.forwardRef(({className:t,sideOffset:e=4,...n},o)=>jsxRuntime.jsx(Portal2$1,{children:jsxRuntime.jsx(Content2$4,{ref:o,sideOffset:e,className:cn("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 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-dropdown-menu-content-transform-origin]",t),...n})}));DropdownMenuContent.displayName=Content2$4.displayName;const DropdownMenuItem=React__namespace.forwardRef(({className:t,inset:e,...n},o)=>jsxRuntime.jsx(Item2,{ref:o,className:cn("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",e&&"pl-8",t),...n}));DropdownMenuItem.displayName=Item2.displayName;const DropdownMenuCheckboxItem=React__namespace.forwardRef(({className:t,children:e,checked:n,...o},l)=>jsxRuntime.jsxs(CheckboxItem2,{ref:l,className:cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...o,children:[jsxRuntime.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(ItemIndicator2,{children:jsxRuntime.jsx(Check,{className:"h-4 w-4"})})}),e]}));DropdownMenuCheckboxItem.displayName=CheckboxItem2.displayName;const DropdownMenuRadioItem=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsxs(RadioItem2,{ref:o,className:cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[jsxRuntime.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(ItemIndicator2,{children:jsxRuntime.jsx(Circle,{className:"h-2 w-2 fill-current"})})}),e]}));DropdownMenuRadioItem.displayName=RadioItem2.displayName;const DropdownMenuLabel=React__namespace.forwardRef(({className:t,inset:e,...n},o)=>jsxRuntime.jsx(Label2,{ref:o,className:cn("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));DropdownMenuLabel.displayName=Label2.displayName;const DropdownMenuSeparator=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Separator2,{ref:n,className:cn("-mx-1 my-1 h-px bg-muted",t),...e}));DropdownMenuSeparator.displayName=Separator2.displayName;const DropdownMenuShortcut=({className:t,...e})=>jsxRuntime.jsx("span",{className:cn("ml-auto text-xs tracking-widest opacity-60",t),...e});DropdownMenuShortcut.displayName="DropdownMenuShortcut";function ProductInventoryGrid({inventory:t,showBinLocation:e}){const n=(j,q,z=!1,Q=!0)=>jsxRuntime.jsxs("div",{className:`p-3 text-sm ${Q&&q>0?"border-t":""} ${z?"border-r":""}`,children:[jsxRuntime.jsxs("div",{className:"flex justify-between font-medium",children:[jsxRuntime.jsx("span",{children:j.Name}),jsxRuntime.jsx("span",{children:j.AvailableQuantity})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-1 text-xs text-gray-600",children:[jsxRuntime.jsx("span",{children:"Expecting"}),jsxRuntime.jsx("span",{children:j.PurchaseOrderQuantity||"-"})]}),e&&jsxRuntime.jsxs("div",{className:"flex justify-between mt-1 text-xs text-gray-600",children:[jsxRuntime.jsx("span",{children:"Bin Location"}),jsxRuntime.jsx("span",{children:j.BinLocation||"-"})]})]},`warehouse-${j.WarehouseId}`),o=["MTL","TOR"],l=["VAN","EDM"],d=[...t].sort((j,q)=>(j.Name||"").localeCompare(q.Name||"")),f=d.filter(j=>j.Country==="US"),g=d.filter(j=>j.Country==="CA"),b=d.filter(j=>l.includes(j.WarehouseId||"")),_=d.filter(j=>o.includes(j.WarehouseId||"")),S=g.filter(j=>!o.includes(j.WarehouseId||"")&&!l.includes(j.WarehouseId||"")),R=j=>j.reduce((q,z)=>q+(z.AvailableQuantity||0),0),C=R(g),E=R(_),A=R(b),I=R(f),M=C+I;return jsxRuntime.jsxs("div",{className:"border rounded-md overflow-hidden",children:[g.length>0&&f.length>0&&jsxRuntime.jsxs("div",{className:"grid grid-cols-2 border-b",children:[jsxRuntime.jsxs("div",{className:"p-3 font-semibold text-sm flex justify-between",children:[jsxRuntime.jsx("span",{children:"Total"}),jsxRuntime.jsx("span",{children:M})]}),jsxRuntime.jsx("div",{className:"p-3"})]}),g.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 border-b bg-gray-50",children:[jsxRuntime.jsxs("div",{className:"p-3 font-semibold text-sm flex justify-between",children:[jsxRuntime.jsx("span",{children:"Canada"}),jsxRuntime.jsx("span",{children:C})]}),jsxRuntime.jsx("div",{className:"p-3"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2",children:[jsxRuntime.jsxs("div",{className:"border-r",children:[jsxRuntime.jsxs("div",{className:"p-3 font-semibold text-sm flex justify-between",children:[jsxRuntime.jsx("span",{children:"West"}),jsxRuntime.jsx("span",{children:A})]}),b.map((j,q)=>n(j,q))]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"p-3 font-semibold text-sm flex justify-between",children:[jsxRuntime.jsx("span",{children:"East"}),jsxRuntime.jsx("span",{children:E})]}),_.map((j,q)=>n(j,q))]})]}),S.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"border-t p-3 font-semibold text-sm",children:jsxRuntime.jsx("span",{children:"Other"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-2",children:S.map((j,q)=>n(j,q,q%2===0,!0))})]})]}),f.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 border-t bg-gray-50",children:[jsxRuntime.jsxs("div",{className:"p-3 font-semibold text-sm flex justify-between",children:[jsxRuntime.jsx("span",{children:"United States"}),jsxRuntime.jsx("span",{children:I})]}),jsxRuntime.jsx("div",{className:"p-3"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-2",children:f.map((j,q)=>n(j,q,q%2===0,!0))})]}),t.length===0&&jsxRuntime.jsx("div",{className:"p-6 text-center text-gray-500",children:"No inventory information available"})]})}const falsyToString=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,cx=clsx,cva=(t,e)=>n=>{var o;if((e==null?void 0:e.variants)==null)return cx(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:l,defaultVariants:d}=e,f=Object.keys(l).map(_=>{const S=n==null?void 0:n[_],R=d==null?void 0:d[_];if(S===null)return null;const C=falsyToString(S)||falsyToString(R);return l[_][C]}),g=n&&Object.entries(n).reduce((_,S)=>{let[R,C]=S;return C===void 0||(_[R]=C),_},{}),b=e==null||(o=e.compoundVariants)===null||o===void 0?void 0:o.reduce((_,S)=>{let{class:R,className:C,...E}=S;return Object.entries(E).every(A=>{let[I,M]=A;return Array.isArray(M)?M.includes({...d,...g}[I]):{...d,...g}[I]===M})?[..._,R,C]:_},[]);return cx(t,f,b,n==null?void 0:n.class,n==null?void 0:n.className)},buttonVariants=cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 cursor-pointer",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90",outline:"border border-input text-foreground bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",defaultOutline:"border border-red-600/30 text-red-600 bg-background shadow-xs hover:bg-red-600/5 ",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",blue:"bg-randmar-blue text-gray-100 shadow-sm hover:bg-randmar-blue/90",red:"bg-randmar-red text-gray-100 shadow-sm hover:bg-randmar-red/90",purple:"bg-randmar-purple text-gray-100 shadow-sm hover:bg-randmar-purple/90",none:""},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Button=React__namespace.forwardRef(({className:t,variant:e,size:n,asChild:o=!1,confirmationDialog:l,onClick:d,...f},g)=>{const b=o?Slot$4:"button";if(!l)return jsxRuntime.jsx(b,{className:cn(buttonVariants({variant:e,size:n,className:t})),ref:g,onClick:d,...f});d&&console.warn("Button: You provided both onClick and confirmationDialog props. The onClick prop will be ignored. Use the onConfirm callback in confirmationDialog instead.");const{title:_,content:S,onConfirm:R,confirmText:C="Confirm",cancelText:E="Cancel"}=l,A=()=>{R()};return jsxRuntime.jsxs(Dialog,{children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsx(b,{className:cn(buttonVariants({variant:e,size:n,className:t})),ref:g,...f})}),jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:_}),jsxRuntime.jsx(DialogDescription,{children:S})]}),jsxRuntime.jsxs(DialogFooter,{className:"flex justify-end gap-2 pt-4",children:[jsxRuntime.jsx(DialogClose,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"outline",children:E})}),jsxRuntime.jsx(DialogClose,{asChild:!0,children:jsxRuntime.jsx(Button,{onClick:A,children:C})})]})]})]})});Button.displayName="Button";var VISUALLY_HIDDEN_STYLES=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),NAME$2="VisuallyHidden",VisuallyHidden=React__namespace.forwardRef((t,e)=>jsxRuntime.jsx(Primitive.span,{...t,ref:e,style:{...VISUALLY_HIDDEN_STYLES,...t.style}}));VisuallyHidden.displayName=NAME$2;var Root$6=VisuallyHidden,[createTooltipContext,createTooltipScope]=createContextScope("Tooltip",[createPopperScope]),usePopperScope$2=createPopperScope(),PROVIDER_NAME$1="TooltipProvider",DEFAULT_DELAY_DURATION=700,TOOLTIP_OPEN="tooltip.open",[TooltipProviderContextProvider,useTooltipProviderContext]=createTooltipContext(PROVIDER_NAME$1),TooltipProvider$1=t=>{const{__scopeTooltip:e,delayDuration:n=DEFAULT_DELAY_DURATION,skipDelayDuration:o=300,disableHoverableContent:l=!1,children:d}=t,f=React__namespace.useRef(!0),g=React__namespace.useRef(!1),b=React__namespace.useRef(0);return React__namespace.useEffect(()=>{const _=b.current;return()=>window.clearTimeout(_)},[]),jsxRuntime.jsx(TooltipProviderContextProvider,{scope:e,isOpenDelayedRef:f,delayDuration:n,onOpen:React__namespace.useCallback(()=>{window.clearTimeout(b.current),f.current=!1},[]),onClose:React__namespace.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>f.current=!0,o)},[o]),isPointerInTransitRef:g,onPointerInTransitChange:React__namespace.useCallback(_=>{g.current=_},[]),disableHoverableContent:l,children:d})};TooltipProvider$1.displayName=PROVIDER_NAME$1;var TOOLTIP_NAME="Tooltip",[TooltipContextProvider,useTooltipContext]=createTooltipContext(TOOLTIP_NAME),Tooltip$2=t=>{const{__scopeTooltip:e,children:n,open:o,defaultOpen:l,onOpenChange:d,disableHoverableContent:f,delayDuration:g}=t,b=useTooltipProviderContext(TOOLTIP_NAME,t.__scopeTooltip),_=usePopperScope$2(e),[S,R]=React__namespace.useState(null),C=useId(),E=React__namespace.useRef(0),A=f??b.disableHoverableContent,I=g??b.delayDuration,M=React__namespace.useRef(!1),[j,q]=useControllableState({prop:o,defaultProp:l??!1,onChange:te=>{te?(b.onOpen(),document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN))):b.onClose(),d==null||d(te)},caller:TOOLTIP_NAME}),z=React__namespace.useMemo(()=>j?M.current?"delayed-open":"instant-open":"closed",[j]),Q=React__namespace.useCallback(()=>{window.clearTimeout(E.current),E.current=0,M.current=!1,q(!0)},[q]),F=React__namespace.useCallback(()=>{window.clearTimeout(E.current),E.current=0,q(!1)},[q]),O=React__namespace.useCallback(()=>{window.clearTimeout(E.current),E.current=window.setTimeout(()=>{M.current=!0,q(!0),E.current=0},I)},[I,q]);return React__namespace.useEffect(()=>()=>{E.current&&(window.clearTimeout(E.current),E.current=0)},[]),jsxRuntime.jsx(Root2$6,{..._,children:jsxRuntime.jsx(TooltipContextProvider,{scope:e,contentId:C,open:j,stateAttribute:z,trigger:S,onTriggerChange:R,onTriggerEnter:React__namespace.useCallback(()=>{b.isOpenDelayedRef.current?O():Q()},[b.isOpenDelayedRef,O,Q]),onTriggerLeave:React__namespace.useCallback(()=>{A?F():(window.clearTimeout(E.current),E.current=0)},[F,A]),onOpen:Q,onClose:F,disableHoverableContent:A,children:n})})};Tooltip$2.displayName=TOOLTIP_NAME;var TRIGGER_NAME$5="TooltipTrigger",TooltipTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeTooltip:n,...o}=t,l=useTooltipContext(TRIGGER_NAME$5,n),d=useTooltipProviderContext(TRIGGER_NAME$5,n),f=usePopperScope$2(n),g=React__namespace.useRef(null),b=useComposedRefs(e,g,l.onTriggerChange),_=React__namespace.useRef(!1),S=React__namespace.useRef(!1),R=React__namespace.useCallback(()=>_.current=!1,[]);return React__namespace.useEffect(()=>()=>document.removeEventListener("pointerup",R),[R]),jsxRuntime.jsx(Anchor,{asChild:!0,...f,children:jsxRuntime.jsx(Primitive.button,{"aria-describedby":l.open?l.contentId:void 0,"data-state":l.stateAttribute,...o,ref:b,onPointerMove:composeEventHandlers(t.onPointerMove,C=>{C.pointerType!=="touch"&&!S.current&&!d.isPointerInTransitRef.current&&(l.onTriggerEnter(),S.current=!0)}),onPointerLeave:composeEventHandlers(t.onPointerLeave,()=>{l.onTriggerLeave(),S.current=!1}),onPointerDown:composeEventHandlers(t.onPointerDown,()=>{l.open&&l.onClose(),_.current=!0,document.addEventListener("pointerup",R,{once:!0})}),onFocus:composeEventHandlers(t.onFocus,()=>{_.current||l.onOpen()}),onBlur:composeEventHandlers(t.onBlur,l.onClose),onClick:composeEventHandlers(t.onClick,l.onClose)})})});TooltipTrigger$1.displayName=TRIGGER_NAME$5;var PORTAL_NAME$3="TooltipPortal",[PortalProvider$1,usePortalContext$1]=createTooltipContext(PORTAL_NAME$3,{forceMount:void 0}),TooltipPortal=t=>{const{__scopeTooltip:e,forceMount:n,children:o,container:l}=t,d=useTooltipContext(PORTAL_NAME$3,e);return jsxRuntime.jsx(PortalProvider$1,{scope:e,forceMount:n,children:jsxRuntime.jsx(Presence,{present:n||d.open,children:jsxRuntime.jsx(Portal$5,{asChild:!0,container:l,children:o})})})};TooltipPortal.displayName=PORTAL_NAME$3;var CONTENT_NAME$4="TooltipContent",TooltipContent$1=React__namespace.forwardRef((t,e)=>{const n=usePortalContext$1(CONTENT_NAME$4,t.__scopeTooltip),{forceMount:o=n.forceMount,side:l="top",...d}=t,f=useTooltipContext(CONTENT_NAME$4,t.__scopeTooltip);return jsxRuntime.jsx(Presence,{present:o||f.open,children:f.disableHoverableContent?jsxRuntime.jsx(TooltipContentImpl,{side:l,...d,ref:e}):jsxRuntime.jsx(TooltipContentHoverable,{side:l,...d,ref:e})})}),TooltipContentHoverable=React__namespace.forwardRef((t,e)=>{const n=useTooltipContext(CONTENT_NAME$4,t.__scopeTooltip),o=useTooltipProviderContext(CONTENT_NAME$4,t.__scopeTooltip),l=React__namespace.useRef(null),d=useComposedRefs(e,l),[f,g]=React__namespace.useState(null),{trigger:b,onClose:_}=n,S=l.current,{onPointerInTransitChange:R}=o,C=React__namespace.useCallback(()=>{g(null),R(!1)},[R]),E=React__namespace.useCallback((A,I)=>{const M=A.currentTarget,j={x:A.clientX,y:A.clientY},q=getExitSideFromRect(j,M.getBoundingClientRect()),z=getPaddedExitPoints(j,q),Q=getPointsFromRect(I.getBoundingClientRect()),F=getHull([...z,...Q]);g(F),R(!0)},[R]);return React__namespace.useEffect(()=>()=>C(),[C]),React__namespace.useEffect(()=>{if(b&&S){const A=M=>E(M,S),I=M=>E(M,b);return b.addEventListener("pointerleave",A),S.addEventListener("pointerleave",I),()=>{b.removeEventListener("pointerleave",A),S.removeEventListener("pointerleave",I)}}},[b,S,E,C]),React__namespace.useEffect(()=>{if(f){const A=I=>{const M=I.target,j={x:I.clientX,y:I.clientY},q=(b==null?void 0:b.contains(M))||(S==null?void 0:S.contains(M)),z=!isPointInPolygon(j,f);q?C():z&&(C(),_())};return document.addEventListener("pointermove",A),()=>document.removeEventListener("pointermove",A)}},[b,S,f,_,C]),jsxRuntime.jsx(TooltipContentImpl,{...t,ref:d})}),[VisuallyHiddenContentContextProvider,useVisuallyHiddenContentContext]=createTooltipContext(TOOLTIP_NAME,{isInside:!1}),Slottable$1=createSlottable("TooltipContent"),TooltipContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopeTooltip:n,children:o,"aria-label":l,onEscapeKeyDown:d,onPointerDownOutside:f,...g}=t,b=useTooltipContext(CONTENT_NAME$4,n),_=usePopperScope$2(n),{onClose:S}=b;return React__namespace.useEffect(()=>(document.addEventListener(TOOLTIP_OPEN,S),()=>document.removeEventListener(TOOLTIP_OPEN,S)),[S]),React__namespace.useEffect(()=>{if(b.trigger){const R=C=>{const E=C.target;E!=null&&E.contains(b.trigger)&&S()};return window.addEventListener("scroll",R,{capture:!0}),()=>window.removeEventListener("scroll",R,{capture:!0})}},[b.trigger,S]),jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:R=>R.preventDefault(),onDismiss:S,children:jsxRuntime.jsxs(Content$1,{"data-state":b.stateAttribute,..._,...g,ref:e,style:{...g.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[jsxRuntime.jsx(Slottable$1,{children:o}),jsxRuntime.jsx(VisuallyHiddenContentContextProvider,{scope:n,isInside:!0,children:jsxRuntime.jsx(Root$6,{id:b.contentId,role:"tooltip",children:l||o})})]})})});TooltipContent$1.displayName=CONTENT_NAME$4;var ARROW_NAME$2="TooltipArrow",TooltipArrow=React__namespace.forwardRef((t,e)=>{const{__scopeTooltip:n,...o}=t,l=usePopperScope$2(n);return useVisuallyHiddenContentContext(ARROW_NAME$2,n).isInside?null:jsxRuntime.jsx(Arrow,{...l,...o,ref:e})});TooltipArrow.displayName=ARROW_NAME$2;function getExitSideFromRect(t,e){const n=Math.abs(e.top-t.y),o=Math.abs(e.bottom-t.y),l=Math.abs(e.right-t.x),d=Math.abs(e.left-t.x);switch(Math.min(n,o,l,d)){case d:return"left";case l:return"right";case n:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function getPaddedExitPoints(t,e,n=5){const o=[];switch(e){case"top":o.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":o.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":o.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":o.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return o}function getPointsFromRect(t){const{top:e,right:n,bottom:o,left:l}=t;return[{x:l,y:e},{x:n,y:e},{x:n,y:o},{x:l,y:o}]}function isPointInPolygon(t,e){const{x:n,y:o}=t;let l=!1;for(let d=0,f=e.length-1;d<e.length;f=d++){const g=e[d],b=e[f],_=g.x,S=g.y,R=b.x,C=b.y;S>o!=C>o&&n<(R-_)*(o-S)/(C-S)+_&&(l=!l)}return l}function getHull(t){const e=t.slice();return e.sort((n,o)=>n.x<o.x?-1:n.x>o.x?1:n.y<o.y?-1:n.y>o.y?1:0),getHullPresorted(e)}function getHullPresorted(t){if(t.length<=1)return t.slice();const e=[];for(let o=0;o<t.length;o++){const l=t[o];for(;e.length>=2;){const d=e[e.length-1],f=e[e.length-2];if((d.x-f.x)*(l.y-f.y)>=(d.y-f.y)*(l.x-f.x))e.pop();else break}e.push(l)}e.pop();const n=[];for(let o=t.length-1;o>=0;o--){const l=t[o];for(;n.length>=2;){const d=n[n.length-1],f=n[n.length-2];if((d.x-f.x)*(l.y-f.y)>=(d.y-f.y)*(l.x-f.x))n.pop();else break}n.push(l)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var Provider$1=TooltipProvider$1,Root3=Tooltip$2,Trigger$3=TooltipTrigger$1,Portal$2=TooltipPortal,Content2$3=TooltipContent$1;const TooltipProvider=Provider$1,Tooltip$1=Root3,TooltipTrigger=Trigger$3,TooltipContent=React__namespace.forwardRef(({className:t,sideOffset:e=4,...n},o)=>jsxRuntime.jsx(Portal$2,{children:jsxRuntime.jsx(Content2$3,{ref:o,sideOffset:e,className:cn("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",t),...n})}));TooltipContent.displayName=Content2$3.displayName;const Input=React__namespace.forwardRef(({className:t,type:e,mask:n,onChange:o,placeholder:l,...d},f)=>{const[g,b]=React__namespace.useState(!1),_=React__namespace.useRef(null),R=l||(n==="phone"?"(999) 999-9999":n==="postal-code-ca"?"A9A 9A9":n==="zip-code-us"?"99999":""),C=()=>n==="phone"?"Only enter numbers. Formatting will be added automatically.":n==="postal-code-ca"?"Enter letters and numbers only. Spacing will be applied automatically.":n==="zip-code-us"?"Only enter numbers. Formatting will be added automatically.":"",E=()=>{b(!0),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{b(!1)},3e3)};React__namespace.useEffect(()=>()=>{_.current&&clearTimeout(_.current)},[]);const A=I=>{if(n){const M=I.target.value;let j=M;if(M.length>0){const q=M[M.length-1];/[^a-zA-Z0-9]/.test(q)&&(console.log("Non-alphanumeric detected:",q),E())}if(n==="phone"){const q=M.replace(/\D/g,"");q.length<=3?j=q:q.length<=6?j=`(${q.slice(0,3)}) ${q.slice(3)}`:j=`(${q.slice(0,3)}) ${q.slice(3,6)}-${q.slice(6,10)}`}else if(n==="postal-code-ca"){const q=M.replace(/[^a-zA-Z0-9]/g,"").toUpperCase();let z="";for(let Q=0;Q<Math.min(q.length,6);Q++){const F=q[Q];Q===0||Q===2||Q===4?/[A-Z]/.test(F)&&(z+=F):(Q===1||Q===3||Q===5)&&/[0-9]/.test(F)&&(z+=F)}z.length<=3?j=z:j=`${z.slice(0,3)} ${z.slice(3,6)}`}else if(n==="zip-code-us"){const q=M.replace(/\D/g,"");q.length<=5?j=q:j=`${q.slice(0,5)}-${q.slice(5,9)}`}I.target.value=j}o==null||o(I)};return jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{open:g&&!!n,children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx("input",{type:e,className:cn("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),onChange:A,placeholder:R,ref:f,...d})}),jsxRuntime.jsx(TooltipContent,{side:"top",className:"bg-sidebar text-sidebar-foreground",children:C()})]})})});Input.displayName="Input";var NAME$1="Separator",DEFAULT_ORIENTATION="horizontal",ORIENTATIONS=["horizontal","vertical"],Separator$2=React__namespace.forwardRef((t,e)=>{const{decorative:n,orientation:o=DEFAULT_ORIENTATION,...l}=t,d=isValidOrientation(o)?o:DEFAULT_ORIENTATION,g=n?{role:"none"}:{"aria-orientation":d==="vertical"?d:void 0,role:"separator"};return jsxRuntime.jsx(Primitive.div,{"data-orientation":d,...g,...l,ref:e})});Separator$2.displayName=NAME$1;function isValidOrientation(t){return ORIENTATIONS.includes(t)}var Root$5=Separator$2;const Separator$1=React__namespace.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...o},l)=>jsxRuntime.jsx(Root$5,{ref:l,decorative:n,orientation:e,className:cn("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...o}));Separator$1.displayName=Root$5.displayName;const Sheet=Root$8,SheetTrigger=Trigger$5,SheetClose=Close$1,SheetPortal=Portal$4,SheetOverlay=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Overlay,{className:cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));SheetOverlay.displayName=Overlay.displayName;const sheetVariants=cva("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),SheetContent=React__namespace.forwardRef(({side:t="right",className:e,children:n,...o},l)=>jsxRuntime.jsxs(SheetPortal,{children:[jsxRuntime.jsx(SheetOverlay,{}),jsxRuntime.jsxs(Content$2,{ref:l,className:cn(sheetVariants({side:t}),e),...o,children:[jsxRuntime.jsxs(Close$1,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[jsxRuntime.jsx(X$1,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Close"})]}),n]})]}));SheetContent.displayName=Content$2.displayName;const SheetHeader=({className:t,...e})=>jsxRuntime.jsx("div",{className:cn("flex flex-col space-y-2 text-center sm:text-left",t),...e});SheetHeader.displayName="SheetHeader";const SheetFooter=({className:t,...e})=>jsxRuntime.jsx("div",{className:cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});SheetFooter.displayName="SheetFooter";const SheetTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Title$1,{ref:n,className:cn("text-lg font-semibold text-foreground",t),...e}));SheetTitle.displayName=Title$1.displayName;const SheetDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Description$1,{ref:n,className:cn("text-sm text-muted-foreground",t),...e}));SheetDescription.displayName=Description$1.displayName;function AvatarFooter({onClick:t,publicName:e,applicationName:n,partnerId:o}){const l=`https://api.randmar.io/v4/Partner/${o}/Account/Logo?height=72&width=72`,[d,f]=React.useState(!1),g=()=>{f(!0)};return jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-muted "+(t!==void 0?"cursor-pointer":""),children:d?jsxRuntime.jsx(Button,{asChild:!0,size:"icon",onClick:t,children:jsxRuntime.jsx(TriangleAlert,{className:"h-5 w-5 text-muted-foreground !bg-sidebar"})}):jsxRuntime.jsx(Button,{asChild:!0,size:"icon",onClick:t,children:jsxRuntime.jsx("img",{src:l,alt:"Partner logo",className:"h-9 w-9 object-cover !bg-sidebar",onError:g})})}),jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:e||"Partner"}),jsxRuntime.jsx("span",{className:"text-xs text-neutral-400",children:n})]})]})}var NAME="Label",Label$3=React__namespace.forwardRef((t,e)=>jsxRuntime.jsx(Primitive.label,{...t,ref:e,onMouseDown:n=>{var l;n.target.closest("button, input, select, textarea")||((l=t.onMouseDown)==null||l.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Label$3.displayName=NAME;var Root$4=Label$3;function Label$2({className:t,...e}){return jsxRuntime.jsx(Root$4,{"data-slot":"label",className:cn("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}const MOBILE_BREAKPOINT=1024;function useIsMobile(){const[t,e]=React__namespace.useState(void 0);return React__namespace.useEffect(()=>{const n=window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT-1}px)`),o=()=>{e(window.innerWidth<MOBILE_BREAKPOINT)};return n.addEventListener("change",o),e(window.innerWidth<MOBILE_BREAKPOINT),()=>n.removeEventListener("change",o)},[]),!!t}function Skeleton({className:t,...e}){return jsxRuntime.jsx("div",{className:cn("animate-pulse rounded-md bg-primary/20",t),...e})}const SIDEBAR_COOKIE_NAME="sidebar:state",SIDEBAR_COOKIE_MAX_AGE=60*60*24*7,SIDEBAR_WIDTH="16rem",SIDEBAR_WIDTH_MOBILE="18rem",SIDEBAR_WIDTH_ICON="3rem",SIDEBAR_KEYBOARD_SHORTCUT="b",SidebarContext=React__namespace.createContext(null);function useSidebar(){const t=React__namespace.useContext(SidebarContext);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}const SidebarProvider=React__namespace.forwardRef(({defaultOpen:t=!0,open:e,onOpenChange:n,className:o,style:l,children:d,...f},g)=>{const b=useIsMobile(),[_,S]=React__namespace.useState(!1),[R,C]=React__namespace.useState(t),E=e??R,A=React__namespace.useCallback(q=>{const z=typeof q=="function"?q(E):q;n?n(z):C(z),document.cookie=`${SIDEBAR_COOKIE_NAME}=${z}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`},[n,E]),I=React__namespace.useCallback(()=>b?S(q=>!q):A(q=>!q),[b,A,S]);React__namespace.useEffect(()=>{const q=z=>{z.key===SIDEBAR_KEYBOARD_SHORTCUT&&(z.metaKey||z.ctrlKey)&&(z.preventDefault(),I())};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[I]);const M=E?"expanded":"collapsed",j=React__namespace.useMemo(()=>({state:M,open:E,setOpen:A,isMobile:b,openMobile:_,setOpenMobile:S,toggleSidebar:I}),[M,E,A,b,_,S,I]);return jsxRuntime.jsx(SidebarContext.Provider,{value:j,children:jsxRuntime.jsx(TooltipProvider,{delayDuration:0,children:jsxRuntime.jsx("div",{style:{"--sidebar-width":SIDEBAR_WIDTH,"--sidebar-width-icon":SIDEBAR_WIDTH_ICON,...l},className:cn("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",o),ref:g,...f,children:d})})})});SidebarProvider.displayName="SidebarProvider";const Sidebar=React__namespace.forwardRef(({side:t="left",variant:e="sidebar",collapsible:n="offcanvas",className:o,children:l,...d},f)=>{const{isMobile:g,state:b,openMobile:_,setOpenMobile:S}=useSidebar();return n==="none"?jsxRuntime.jsx("div",{className:cn("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",o),ref:f,...d,children:l}):g?jsxRuntime.jsx(Sheet,{open:_,onOpenChange:S,...d,children:jsxRuntime.jsx(SheetContent,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":SIDEBAR_WIDTH_MOBILE},side:t,children:jsxRuntime.jsx("div",{className:"flex h-full w-full flex-col",children:l})})}):jsxRuntime.jsxs("div",{ref:f,className:"group peer hidden md:block text-sidebar-foreground","data-state":b,"data-collapsible":b==="collapsed"?n:"","data-variant":e,"data-side":t,children:[jsxRuntime.jsx("div",{className:cn("duration-200 relative h-svh w-(--sidebar-width) bg-transparent transition-[width] ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",e==="floating"||e==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),jsxRuntime.jsx("div",{className:cn("duration-200 fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] ease-linear md:flex",t==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",e==="floating"||e==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",o),...d,children:jsxRuntime.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm",children:l})})]})});Sidebar.displayName="Sidebar";const SidebarTrigger=React__namespace.forwardRef(({className:t,onClick:e,...n},o)=>{const{toggleSidebar:l}=useSidebar();return jsxRuntime.jsxs(Button,{ref:o,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:cn("h-7 w-7 text-sidebar-foreground",t),onClick:d=>{e==null||e(d),l()},...n,children:[jsxRuntime.jsx(PanelLeft,{}),jsxRuntime.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});SidebarTrigger.displayName="SidebarTrigger";const SidebarRail=React__namespace.forwardRef(({className:t,...e},n)=>{const{toggleSidebar:o}=useSidebar();return jsxRuntime.jsx("button",{ref:n,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:o,title:"Toggle Sidebar",className:cn("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",t),...e})});SidebarRail.displayName="SidebarRail";const SidebarInset=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("main",{ref:n,className:cn("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-h-[calc(100svh-(--spacing(4)))] md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm",t),...e}));SidebarInset.displayName="SidebarInset";const SidebarInput=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Input,{ref:n,"data-sidebar":"input",className:cn("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",t),...e}));SidebarInput.displayName="SidebarInput";const SidebarHeader=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,"data-sidebar":"header",className:cn("flex flex-col gap-2 p-2",t),...e}));SidebarHeader.displayName="SidebarHeader";const SidebarFooter=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,"data-sidebar":"footer",className:cn("flex flex-col gap-2 p-2",t),...e}));SidebarFooter.displayName="SidebarFooter";const SidebarSeparator=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Separator$1,{ref:n,"data-sidebar":"separator",className:cn("mx-2 w-auto bg-sidebar-border",t),...e}));SidebarSeparator.displayName="SidebarSeparator";const SidebarContent=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,"data-sidebar":"content",className:cn("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...e}));SidebarContent.displayName="SidebarContent";const SidebarGroup=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,"data-sidebar":"group",className:cn("relative flex w-full min-w-0 flex-col p-2",t),...e}));SidebarGroup.displayName="SidebarGroup";const SidebarGroupLabel=React__namespace.forwardRef(({className:t,asChild:e=!1,...n},o)=>{const l=e?Slot$4:"div";return jsxRuntime.jsx(l,{ref:o,"data-sidebar":"group-label",className:cn("duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-hidden ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",t),...n})});SidebarGroupLabel.displayName="SidebarGroupLabel";const SidebarGroupAction=React__namespace.forwardRef(({className:t,asChild:e=!1,...n},o)=>{const l=e?Slot$4:"button";return jsxRuntime.jsx(l,{ref:o,"data-sidebar":"group-action",className:cn("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-hidden ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 md:after:hidden","group-data-[collapsible=icon]:hidden",t),...n})});SidebarGroupAction.displayName="SidebarGroupAction";const SidebarGroupContent=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,"data-sidebar":"group-content",className:cn("w-full text-sm",t),...e}));SidebarGroupContent.displayName="SidebarGroupContent";const SidebarMenu=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("ul",{ref:n,"data-sidebar":"menu",className:cn("flex w-full min-w-0 flex-col gap-1",t),...e}));SidebarMenu.displayName="SidebarMenu";const SidebarMenuItem=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("li",{ref:n,"data-sidebar":"menu-item",className:cn("group/menu-item relative",t),...e}));SidebarMenuItem.displayName="SidebarMenuItem";const sidebarMenuButtonVariants=cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}}),SidebarMenuButton=React__namespace.forwardRef(({asChild:t=!1,isActive:e=!1,variant:n="default",size:o="default",tooltip:l,className:d,...f},g)=>{const b=t?Slot$4:"button",{isMobile:_,state:S}=useSidebar(),R=jsxRuntime.jsx(b,{ref:g,"data-sidebar":"menu-button","data-size":o,"data-active":e,className:cn(sidebarMenuButtonVariants({variant:n,size:o}),d),...f});return l?(typeof l=="string"&&(l={children:l}),jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:R}),jsxRuntime.jsx(TooltipContent,{side:"right",align:"center",hidden:S!=="collapsed"||_,...l})]})):R});SidebarMenuButton.displayName="SidebarMenuButton";const SidebarMenuAction=React__namespace.forwardRef(({className:t,asChild:e=!1,showOnHover:n=!1,...o},l)=>{const d=e?Slot$4:"button";return jsxRuntime.jsx(d,{ref:l,"data-sidebar":"menu-action",className:cn("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-hidden ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 md:after:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",n&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",t),...o})});SidebarMenuAction.displayName="SidebarMenuAction";const SidebarMenuBadge=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,"data-sidebar":"menu-badge",className:cn("absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",t),...e}));SidebarMenuBadge.displayName="SidebarMenuBadge";const SidebarMenuSkeleton=React__namespace.forwardRef(({className:t,showIcon:e=!1,...n},o)=>{const l=React__namespace.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return jsxRuntime.jsxs("div",{ref:o,"data-sidebar":"menu-skeleton",className:cn("rounded-md h-8 flex gap-2 px-2 items-center",t),...n,children:[e&&jsxRuntime.jsx(Skeleton,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),jsxRuntime.jsx(Skeleton,{className:"h-4 flex-1 max-w-(--skeleton-width)","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":l}})]})});SidebarMenuSkeleton.displayName="SidebarMenuSkeleton";const SidebarMenuSub=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("ul",{ref:n,"data-sidebar":"menu-sub",className:cn("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",t),...e}));SidebarMenuSub.displayName="SidebarMenuSub";const SidebarMenuSubItem=React__namespace.forwardRef(({...t},e)=>jsxRuntime.jsx("li",{ref:e,...t}));SidebarMenuSubItem.displayName="SidebarMenuSubItem";const SidebarMenuSubButton=React__namespace.forwardRef(({asChild:t=!1,size:e="md",isActive:n,className:o,...l},d)=>{const f=t?Slot$4:"a";return jsxRuntime.jsx(f,{ref:d,"data-sidebar":"menu-sub-button","data-size":e,"data-active":n,className:cn("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-hidden ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",e==="sm"&&"text-xs",e==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",o),...l})});SidebarMenuSubButton.displayName="SidebarMenuSubButton";var PROVIDER_NAME="ToastProvider",[Collection$1,useCollection$1,createCollectionScope$1]=createCollection("Toast"),[createToastContext,createToastScope]=createContextScope("Toast",[createCollectionScope$1]),[ToastProviderProvider,useToastProviderContext]=createToastContext(PROVIDER_NAME),ToastProvider$1=t=>{const{__scopeToast:e,label:n="Notification",duration:o=5e3,swipeDirection:l="right",swipeThreshold:d=50,children:f}=t,[g,b]=React__namespace.useState(null),[_,S]=React__namespace.useState(0),R=React__namespace.useRef(!1),C=React__namespace.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${PROVIDER_NAME}\`. Expected non-empty \`string\`.`),jsxRuntime.jsx(Collection$1.Provider,{scope:e,children:jsxRuntime.jsx(ToastProviderProvider,{scope:e,label:n,duration:o,swipeDirection:l,swipeThreshold:d,toastCount:_,viewport:g,onViewportChange:b,onToastAdd:React__namespace.useCallback(()=>S(E=>E+1),[]),onToastRemove:React__namespace.useCallback(()=>S(E=>E-1),[]),isFocusedToastEscapeKeyDownRef:R,isClosePausedRef:C,children:f})})};ToastProvider$1.displayName=PROVIDER_NAME;var VIEWPORT_NAME$2="ToastViewport",VIEWPORT_DEFAULT_HOTKEY=["F8"],VIEWPORT_PAUSE="toast.viewportPause",VIEWPORT_RESUME="toast.viewportResume",ToastViewport$1=React__namespace.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:o=VIEWPORT_DEFAULT_HOTKEY,label:l="Notifications ({hotkey})",...d}=t,f=useToastProviderContext(VIEWPORT_NAME$2,n),g=useCollection$1(n),b=React__namespace.useRef(null),_=React__namespace.useRef(null),S=React__namespace.useRef(null),R=React__namespace.useRef(null),C=useComposedRefs(e,R,f.onViewportChange),E=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),A=f.toastCount>0;React__namespace.useEffect(()=>{const M=j=>{var z;o.length!==0&&o.every(Q=>j[Q]||j.code===Q)&&((z=R.current)==null||z.focus())};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[o]),React__namespace.useEffect(()=>{const M=b.current,j=R.current;if(A&&M&&j){const q=()=>{if(!f.isClosePausedRef.current){const O=new CustomEvent(VIEWPORT_PAUSE);j.dispatchEvent(O),f.isClosePausedRef.current=!0}},z=()=>{if(f.isClosePausedRef.current){const O=new CustomEvent(VIEWPORT_RESUME);j.dispatchEvent(O),f.isClosePausedRef.current=!1}},Q=O=>{!M.contains(O.relatedTarget)&&z()},F=()=>{M.contains(document.activeElement)||z()};return M.addEventListener("focusin",q),M.addEventListener("focusout",Q),M.addEventListener("pointermove",q),M.addEventListener("pointerleave",F),window.addEventListener("blur",q),window.addEventListener("focus",z),()=>{M.removeEventListener("focusin",q),M.removeEventListener("focusout",Q),M.removeEventListener("pointermove",q),M.removeEventListener("pointerleave",F),window.removeEventListener("blur",q),window.removeEventListener("focus",z)}}},[A,f.isClosePausedRef]);const I=React__namespace.useCallback(({tabbingDirection:M})=>{const q=g().map(z=>{const Q=z.ref.current,F=[Q,...getTabbableCandidates(Q)];return M==="forwards"?F:F.reverse()});return(M==="forwards"?q.reverse():q).flat()},[g]);return React__namespace.useEffect(()=>{const M=R.current;if(M){const j=q=>{var F,O,te;const z=q.altKey||q.ctrlKey||q.metaKey;if(q.key==="Tab"&&!z){const ne=document.activeElement,ae=q.shiftKey;if(q.target===M&&ae){(F=_.current)==null||F.focus();return}const je=I({tabbingDirection:ae?"backwards":"forwards"}),Ne=je.findIndex(Ae=>Ae===ne);focusFirst(je.slice(Ne+1))?q.preventDefault():ae?(O=_.current)==null||O.focus():(te=S.current)==null||te.focus()}};return M.addEventListener("keydown",j),()=>M.removeEventListener("keydown",j)}},[g,I]),jsxRuntime.jsxs(Branch$1,{ref:b,role:"region","aria-label":l.replace("{hotkey}",E),tabIndex:-1,style:{pointerEvents:A?void 0:"none"},children:[A&&jsxRuntime.jsx(FocusProxy,{ref:_,onFocusFromOutsideViewport:()=>{const M=I({tabbingDirection:"forwards"});focusFirst(M)}}),jsxRuntime.jsx(Collection$1.Slot,{scope:n,children:jsxRuntime.jsx(Primitive.ol,{tabIndex:-1,...d,ref:C})}),A&&jsxRuntime.jsx(FocusProxy,{ref:S,onFocusFromOutsideViewport:()=>{const M=I({tabbingDirection:"backwards"});focusFirst(M)}})]})});ToastViewport$1.displayName=VIEWPORT_NAME$2;var FOCUS_PROXY_NAME="ToastFocusProxy",FocusProxy=React__namespace.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:o,...l}=t,d=useToastProviderContext(FOCUS_PROXY_NAME,n);return jsxRuntime.jsx(VisuallyHidden,{"aria-hidden":!0,tabIndex:0,...l,ref:e,style:{position:"fixed"},onFocus:f=>{var _;const g=f.relatedTarget;!((_=d.viewport)!=null&&_.contains(g))&&o()}})});FocusProxy.displayName=FOCUS_PROXY_NAME;var TOAST_NAME="Toast",TOAST_SWIPE_START="toast.swipeStart",TOAST_SWIPE_MOVE="toast.swipeMove",TOAST_SWIPE_CANCEL="toast.swipeCancel",TOAST_SWIPE_END="toast.swipeEnd",Toast$1=React__namespace.forwardRef((t,e)=>{const{forceMount:n,open:o,defaultOpen:l,onOpenChange:d,...f}=t,[g,b]=useControllableState({prop:o,defaultProp:l??!0,onChange:d,caller:TOAST_NAME});return jsxRuntime.jsx(Presence,{present:n||g,children:jsxRuntime.jsx(ToastImpl,{open:g,...f,ref:e,onClose:()=>b(!1),onPause:useCallbackRef$1(t.onPause),onResume:useCallbackRef$1(t.onResume),onSwipeStart:composeEventHandlers(t.onSwipeStart,_=>{_.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:composeEventHandlers(t.onSwipeMove,_=>{const{x:S,y:R}=_.detail.delta;_.currentTarget.setAttribute("data-swipe","move"),_.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${S}px`),_.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${R}px`)}),onSwipeCancel:composeEventHandlers(t.onSwipeCancel,_=>{_.currentTarget.setAttribute("data-swipe","cancel"),_.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),_.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),_.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),_.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:composeEventHandlers(t.onSwipeEnd,_=>{const{x:S,y:R}=_.detail.delta;_.currentTarget.setAttribute("data-swipe","end"),_.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),_.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),_.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${S}px`),_.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${R}px`),b(!1)})})})});Toast$1.displayName=TOAST_NAME;var[ToastInteractiveProvider,useToastInteractiveContext]=createToastContext(TOAST_NAME,{onClose(){}}),ToastImpl=React__namespace.forwardRef((t,e)=>{const{__scopeToast:n,type:o="foreground",duration:l,open:d,onClose:f,onEscapeKeyDown:g,onPause:b,onResume:_,onSwipeStart:S,onSwipeMove:R,onSwipeCancel:C,onSwipeEnd:E,...A}=t,I=useToastProviderContext(TOAST_NAME,n),[M,j]=React__namespace.useState(null),q=useComposedRefs(e,Ae=>j(Ae)),z=React__namespace.useRef(null),Q=React__namespace.useRef(null),F=l||I.duration,O=React__namespace.useRef(0),te=React__namespace.useRef(F),ne=React__namespace.useRef(0),{onToastAdd:ae,onToastRemove:ge}=I,oe=useCallbackRef$1(()=>{var $e;(M==null?void 0:M.contains(document.activeElement))&&(($e=I.viewport)==null||$e.focus()),f()}),je=React__namespace.useCallback(Ae=>{!Ae||Ae===1/0||(window.clearTimeout(ne.current),O.current=new Date().getTime(),ne.current=window.setTimeout(oe,Ae))},[oe]);React__namespace.useEffect(()=>{const Ae=I.viewport;if(Ae){const $e=()=>{je(te.current),_==null||_()},Fe=()=>{const ze=new Date().getTime()-O.current;te.current=te.current-ze,window.clearTimeout(ne.current),b==null||b()};return Ae.addEventListener(VIEWPORT_PAUSE,Fe),Ae.addEventListener(VIEWPORT_RESUME,$e),()=>{Ae.removeEventListener(VIEWPORT_PAUSE,Fe),Ae.removeEventListener(VIEWPORT_RESUME,$e)}}},[I.viewport,F,b,_,je]),React__namespace.useEffect(()=>{d&&!I.isClosePausedRef.current&&je(F)},[d,F,I.isClosePausedRef,je]),React__namespace.useEffect(()=>(ae(),()=>ge()),[ae,ge]);const Ne=React__namespace.useMemo(()=>M?getAnnounceTextContent(M):null,[M]);return I.viewport?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Ne&&jsxRuntime.jsx(ToastAnnounce,{__scopeToast:n,role:"status","aria-live":o==="foreground"?"assertive":"polite","aria-atomic":!0,children:Ne}),jsxRuntime.jsx(ToastInteractiveProvider,{scope:n,onClose:oe,children:ReactDOM__namespace.createPortal(jsxRuntime.jsx(Collection$1.ItemSlot,{scope:n,children:jsxRuntime.jsx(Root$9,{asChild:!0,onEscapeKeyDown:composeEventHandlers(g,()=>{I.isFocusedToastEscapeKeyDownRef.current||oe(),I.isFocusedToastEscapeKeyDownRef.current=!1}),children:jsxRuntime.jsx(Primitive.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":d?"open":"closed","data-swipe-direction":I.swipeDirection,...A,ref:q,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:composeEventHandlers(t.onKeyDown,Ae=>{Ae.key==="Escape"&&(g==null||g(Ae.nativeEvent),Ae.nativeEvent.defaultPrevented||(I.isFocusedToastEscapeKeyDownRef.current=!0,oe()))}),onPointerDown:composeEventHandlers(t.onPointerDown,Ae=>{Ae.button===0&&(z.current={x:Ae.clientX,y:Ae.clientY})}),onPointerMove:composeEventHandlers(t.onPointerMove,Ae=>{if(!z.current)return;const $e=Ae.clientX-z.current.x,Fe=Ae.clientY-z.current.y,ze=!!Q.current,Ve=["left","right"].includes(I.swipeDirection),Be=["left","up"].includes(I.swipeDirection)?Math.min:Math.max,qe=Ve?Be(0,$e):0,Ke=Ve?0:Be(0,Fe),He=Ae.pointerType==="touch"?10:2,Xe={x:qe,y:Ke},tt={originalEvent:Ae,delta:Xe};ze?(Q.current=Xe,handleAndDispatchCustomEvent(TOAST_SWIPE_MOVE,R,tt,{discrete:!1})):isDeltaInDirection(Xe,I.swipeDirection,He)?(Q.current=Xe,handleAndDispatchCustomEvent(TOAST_SWIPE_START,S,tt,{discrete:!1}),Ae.target.setPointerCapture(Ae.pointerId)):(Math.abs($e)>He||Math.abs(Fe)>He)&&(z.current=null)}),onPointerUp:composeEventHandlers(t.onPointerUp,Ae=>{const $e=Q.current,Fe=Ae.target;if(Fe.hasPointerCapture(Ae.pointerId)&&Fe.releasePointerCapture(Ae.pointerId),Q.current=null,z.current=null,$e){const ze=Ae.currentTarget,Ve={originalEvent:Ae,delta:$e};isDeltaInDirection($e,I.swipeDirection,I.swipeThreshold)?handleAndDispatchCustomEvent(TOAST_SWIPE_END,E,Ve,{discrete:!0}):handleAndDispatchCustomEvent(TOAST_SWIPE_CANCEL,C,Ve,{discrete:!0}),ze.addEventListener("click",Be=>Be.preventDefault(),{once:!0})}})})})}),I.viewport)})]}):null}),ToastAnnounce=t=>{const{__scopeToast:e,children:n,...o}=t,l=useToastProviderContext(TOAST_NAME,e),[d,f]=React__namespace.useState(!1),[g,b]=React__namespace.useState(!1);return useNextFrame(()=>f(!0)),React__namespace.useEffect(()=>{const _=window.setTimeout(()=>b(!0),1e3);return()=>window.clearTimeout(_)},[]),g?null:jsxRuntime.jsx(Portal$5,{asChild:!0,children:jsxRuntime.jsx(VisuallyHidden,{...o,children:d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[l.label," ",n]})})})},TITLE_NAME$1="ToastTitle",ToastTitle$1=React__namespace.forwardRef((t,e)=>{const{__scopeToast:n,...o}=t;return jsxRuntime.jsx(Primitive.div,{...o,ref:e})});ToastTitle$1.displayName=TITLE_NAME$1;var DESCRIPTION_NAME$1="ToastDescription",ToastDescription$1=React__namespace.forwardRef((t,e)=>{const{__scopeToast:n,...o}=t;return jsxRuntime.jsx(Primitive.div,{...o,ref:e})});ToastDescription$1.displayName=DESCRIPTION_NAME$1;var ACTION_NAME$1="ToastAction",ToastAction$1=React__namespace.forwardRef((t,e)=>{const{altText:n,...o}=t;return n.trim()?jsxRuntime.jsx(ToastAnnounceExclude,{altText:n,asChild:!0,children:jsxRuntime.jsx(ToastClose$1,{...o,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${ACTION_NAME$1}\`. Expected non-empty \`string\`.`),null)});ToastAction$1.displayName=ACTION_NAME$1;var CLOSE_NAME$1="ToastClose",ToastClose$1=React__namespace.forwardRef((t,e)=>{const{__scopeToast:n,...o}=t,l=useToastInteractiveContext(CLOSE_NAME$1,n);return jsxRuntime.jsx(ToastAnnounceExclude,{asChild:!0,children:jsxRuntime.jsx(Primitive.button,{type:"button",...o,ref:e,onClick:composeEventHandlers(t.onClick,l.onClose)})})});ToastClose$1.displayName=CLOSE_NAME$1;var ToastAnnounceExclude=React__namespace.forwardRef((t,e)=>{const{__scopeToast:n,altText:o,...l}=t;return jsxRuntime.jsx(Primitive.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":o||void 0,...l,ref:e})});function getAnnounceTextContent(t){const e=[];return Array.from(t.childNodes).forEach(o=>{if(o.nodeType===o.TEXT_NODE&&o.textContent&&e.push(o.textContent),isHTMLElement$1(o)){const l=o.ariaHidden||o.hidden||o.style.display==="none",d=o.dataset.radixToastAnnounceExclude==="";if(!l)if(d){const f=o.dataset.radixToastAnnounceAlt;f&&e.push(f)}else e.push(...getAnnounceTextContent(o))}}),e}function handleAndDispatchCustomEvent(t,e,n,{discrete:o}){const l=n.originalEvent.currentTarget,d=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&l.addEventListener(t,e,{once:!0}),o?dispatchDiscreteCustomEvent(l,d):l.dispatchEvent(d)}var isDeltaInDirection=(t,e,n=0)=>{const o=Math.abs(t.x),l=Math.abs(t.y),d=o>l;return e==="left"||e==="right"?d&&o>n:!d&&l>n};function useNextFrame(t=()=>{}){const e=useCallbackRef$1(t);useLayoutEffect2(()=>{let n=0,o=0;return n=window.requestAnimationFrame(()=>o=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(o)}},[e])}function isHTMLElement$1(t){return t.nodeType===t.ELEMENT_NODE}function getTabbableCandidates(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 focusFirst(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var Provider=ToastProvider$1,Viewport$2=ToastViewport$1,Root2$4=Toast$1,Title=ToastTitle$1,Description=ToastDescription$1,Action$1=ToastAction$1,Close=ToastClose$1;const ToastProvider=Provider,ToastViewport=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Viewport$2,{ref:n,className:cn("fixed top-0 z-100 flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));ToastViewport.displayName=Viewport$2.displayName;const toastVariants=cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full sm:data-[state=open]:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground",success:"border-green-600 bg-green-600 text-white",warning:"border-yellow-500 bg-yellow-500 text-white",info:"border-blue-500 bg-blue-500 text-white",secondary:"border-secondary bg-secondary text-secondary-foreground",outline:"border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground"}},defaultVariants:{variant:"default"}}),Toast=React__namespace.forwardRef(({className:t,variant:e,...n},o)=>jsxRuntime.jsx(Root2$4,{ref:o,className:cn(toastVariants({variant:e}),t),...n}));Toast.displayName=Root2$4.displayName;const ToastAction=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Action$1,{ref:n,className:cn("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-hidden focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 hover:group-[.destructive]:border-destructive/30 hover:group-[.destructive]:bg-destructive hover:group-[.destructive]:text-destructive-foreground focus:group-[.destructive]:ring-destructive",t),...e}));ToastAction.displayName=Action$1.displayName;const ToastClose=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Close,{ref:n,className:cn("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-hidden focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 hover:group-[.destructive]:text-red-50 focus:group-[.destructive]:ring-red-400 focus:group-[.destructive]:ring-offset-red-600",t),"toast-close":"",...e,children:jsxRuntime.jsx(X$1,{className:"h-4 w-4"})}));ToastClose.displayName=Close.displayName;const ToastTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Title,{ref:n,className:cn("text-sm font-semibold [&+div]:text-xs",t),...e}));ToastTitle.displayName=Title.displayName;const ToastDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Description,{ref:n,className:cn("text-sm opacity-90",t),...e}));ToastDescription.displayName=Description.displayName;const TOAST_LIMIT=1,TOAST_REMOVE_DELAY=1e6;let count$1=0;function genId(){return count$1=(count$1+1)%Number.MAX_SAFE_INTEGER,count$1.toString()}const toastTimeouts=new Map,addToRemoveQueue=t=>{if(toastTimeouts.has(t))return;const e=setTimeout(()=>{toastTimeouts.delete(t),dispatch({type:"REMOVE_TOAST",toastId:t})},TOAST_REMOVE_DELAY);toastTimeouts.set(t,e)},reducer=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,TOAST_LIMIT)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?addToRemoveQueue(n):t.toasts.forEach(o=>addToRemoveQueue(o.id)),{...t,toasts:t.toasts.map(o=>o.id===n||n===void 0?{...o,open:!1}:o)}}case"REMOVE_TOAST":return{...t,toasts:e.toastId?t.toasts.filter(n=>n.id!==e.toastId):[]}}},listeners=[];let memoryState={toasts:[]};function dispatch(t){memoryState=reducer(memoryState,t),listeners.forEach(e=>e(memoryState))}function toast({...t}){const e=genId(),n=l=>dispatch({type:"UPDATE_TOAST",toast:{...l,id:e}}),o=()=>dispatch({type:"DISMISS_TOAST",toastId:e});return dispatch({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:l=>{l||o()}}}),{id:e,dismiss:o,update:n}}function useToast(){const[t,e]=React__namespace.useState(memoryState);return React__namespace.useEffect(()=>(listeners.push(e),()=>{const n=listeners.indexOf(e);n>-1&&listeners.splice(n,1)}),[]),{...t,toast,dismiss:n=>dispatch({type:"DISMISS_TOAST",toastId:n})}}function Toaster(){const{toasts:t}=useToast();return jsxRuntime.jsxs(ToastProvider,{children:[t.map(function({id:e,title:n,description:o,action:l,...d}){return jsxRuntime.jsxs(Toast,{...d,children:[jsxRuntime.jsxs("div",{className:"grid gap-1",children:[n&&jsxRuntime.jsx(ToastTitle,{children:n}),o&&jsxRuntime.jsx(ToastDescription,{children:o})]}),l,jsxRuntime.jsx(ToastClose,{})]},e)}),jsxRuntime.jsx(ToastViewport,{})]})}const ChatContext=React.createContext(void 0),ChatProvider=({children:t})=>{const e=React.useRef(null),n=(o=-1,l)=>e.current?(e.current.setActiveChatAndSendMessage(o,l),!0):!1;return jsxRuntime.jsx(ChatContext.Provider,{value:{sendMessage:n,chatRef:e},children:t})},useChat=()=>{const t=React.useContext(ChatContext);if(t===void 0)throw new Error("useChat must be used within a ChatProvider");return t};function formatProdErrorMessage$1(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var randomString=()=>Math.random().toString(36).substring(7).split("").join("."),ActionTypes={INIT:`@@redux/INIT${randomString()}`,REPLACE:`@@redux/REPLACE${randomString()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${randomString()}`},actionTypes_default=ActionTypes;function isPlainObject$4(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function miniKindOf(t){if(t===void 0)return"undefined";if(t===null)return"null";const e=typeof t;switch(e){case"boolean":case"string":case"number":case"symbol":case"function":return e}if(Array.isArray(t))return"array";if(isDate(t))return"date";if(isError(t))return"error";const n=ctorName(t);switch(n){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return n}return Object.prototype.toString.call(t).slice(8,-1).toLowerCase().replace(/\s/g,"")}function ctorName(t){return typeof t.constructor=="function"?t.constructor.name:null}function isError(t){return t instanceof Error||typeof t.message=="string"&&t.constructor&&typeof t.constructor.stackTraceLimit=="number"}function isDate(t){return t instanceof Date?!0:typeof t.toDateString=="function"&&typeof t.getDate=="function"&&typeof t.setDate=="function"}function kindOf(t){let e=typeof t;return process.env.NODE_ENV!=="production"&&(e=miniKindOf(t)),e}function warning(t){typeof console<"u"&&typeof console.error=="function"&&console.error(t);try{throw new Error(t)}catch{}}function getUnexpectedStateShapeWarningMessage(t,e,n,o){const l=Object.keys(e),d=n&&n.type===actionTypes_default.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(l.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!isPlainObject$4(t))return`The ${d} has unexpected type of "${kindOf(t)}". Expected argument to be an object with the following keys: "${l.join('", "')}"`;const f=Object.keys(t).filter(g=>!e.hasOwnProperty(g)&&!o[g]);if(f.forEach(g=>{o[g]=!0}),!(n&&n.type===actionTypes_default.REPLACE)&&f.length>0)return`Unexpected ${f.length>1?"keys":"key"} "${f.join('", "')}" found in ${d}. Expected to find one of the known reducer keys instead: "${l.join('", "')}". Unexpected keys will be ignored.`}function assertReducerShape(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:actionTypes_default.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage$1(12):`The slice reducer for key "${e}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof n(void 0,{type:actionTypes_default.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage$1(13):`The slice reducer for key "${e}" returned undefined when probed with a random type. Don't try to handle '${actionTypes_default.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)})}function combineReducers(t){const e=Object.keys(t),n={};for(let f=0;f<e.length;f++){const g=e[f];process.env.NODE_ENV!=="production"&&typeof t[g]>"u"&&warning(`No reducer provided for key "${g}"`),typeof t[g]=="function"&&(n[g]=t[g])}const o=Object.keys(n);let l;process.env.NODE_ENV!=="production"&&(l={});let d;try{assertReducerShape(n)}catch(f){d=f}return function(g={},b){if(d)throw d;if(process.env.NODE_ENV!=="production"){const R=getUnexpectedStateShapeWarningMessage(g,n,b,l);R&&warning(R)}let _=!1;const S={};for(let R=0;R<o.length;R++){const C=o[R],E=n[C],A=g[C],I=E(A,b);if(typeof I>"u"){const M=b&&b.type;throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage$1(14):`When called with an action of type ${M?`"${String(M)}"`:"(unknown type)"}, the slice reducer for key "${C}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}S[C]=I,_=_||I!==A}return _=_||o.length!==Object.keys(g).length,_?S:g}}function isAction(t){return isPlainObject$4(t)&&"type"in t&&typeof t.type=="string"}var NOTHING=Symbol.for("immer-nothing"),DRAFTABLE=Symbol.for("immer-draftable"),DRAFT_STATE=Symbol.for("immer-state"),errors=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function die(t,...e){if(process.env.NODE_ENV!=="production"){const n=errors[t],o=typeof n=="function"?n.apply(null,e):n;throw new Error(`[Immer] ${o}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var getPrototypeOf=Object.getPrototypeOf;function isDraft(t){return!!t&&!!t[DRAFT_STATE]}function isDraftable(t){var e;return t?isPlainObject$3(t)||Array.isArray(t)||!!t[DRAFTABLE]||!!((e=t.constructor)!=null&&e[DRAFTABLE])||isMap(t)||isSet(t):!1}var objectCtorString=Object.prototype.constructor.toString();function isPlainObject$3(t){if(!t||typeof t!="object")return!1;const e=getPrototypeOf(t);if(e===null)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===objectCtorString}function original(t){return isDraft(t)||die(15,t),t[DRAFT_STATE].base_}function each(t,e){getArchtype(t)===0?Reflect.ownKeys(t).forEach(n=>{e(n,t[n],t)}):t.forEach((n,o)=>e(o,n,t))}function getArchtype(t){const e=t[DRAFT_STATE];return e?e.type_:Array.isArray(t)?1:isMap(t)?2:isSet(t)?3:0}function has$1(t,e){return getArchtype(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function get$2(t,e){return getArchtype(t)===2?t.get(e):t[e]}function set$1(t,e,n){const o=getArchtype(t);o===2?t.set(e,n):o===3?t.add(n):t[e]=n}function is$1(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function isMap(t){return t instanceof Map}function isSet(t){return t instanceof Set}function latest(t){return t.copy_||t.base_}function shallowCopy(t,e){if(isMap(t))return new Map(t);if(isSet(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=isPlainObject$3(t);if(e===!0||e==="class_only"&&!n){const o=Object.getOwnPropertyDescriptors(t);delete o[DRAFT_STATE];let l=Reflect.ownKeys(o);for(let d=0;d<l.length;d++){const f=l[d],g=o[f];g.writable===!1&&(g.writable=!0,g.configurable=!0),(g.get||g.set)&&(o[f]={configurable:!0,writable:!0,enumerable:g.enumerable,value:t[f]})}return Object.create(getPrototypeOf(t),o)}else{const o=getPrototypeOf(t);if(o!==null&&n)return{...t};const l=Object.create(o);return Object.assign(l,t)}}function freeze(t,e=!1){return isFrozen(t)||isDraft(t)||!isDraftable(t)||(getArchtype(t)>1&&(t.set=t.add=t.clear=t.delete=dontMutateFrozenCollections),Object.freeze(t),e&&Object.entries(t).forEach(([n,o])=>freeze(o,!0))),t}function dontMutateFrozenCollections(){die(2)}function isFrozen(t){return Object.isFrozen(t)}var plugins={};function getPlugin(t){const e=plugins[t];return e||die(0,t),e}function loadPlugin(t,e){plugins[t]||(plugins[t]=e)}var currentScope;function getCurrentScope(){return currentScope}function createScope(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function usePatchesInScope(t,e){e&&(getPlugin("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function revokeScope(t){leaveScope(t),t.drafts_.forEach(revokeDraft),t.drafts_=null}function leaveScope(t){t===currentScope&&(currentScope=t.parent_)}function enterScope(t){return currentScope=createScope(currentScope,t)}function revokeDraft(t){const e=t[DRAFT_STATE];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function processResult(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[DRAFT_STATE].modified_&&(revokeScope(e),die(4)),isDraftable(t)&&(t=finalize(e,t),e.parent_||maybeFreeze(e,t)),e.patches_&&getPlugin("Patches").generateReplacementPatches_(n[DRAFT_STATE].base_,t,e.patches_,e.inversePatches_)):t=finalize(e,n,[]),revokeScope(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==NOTHING?t:void 0}function finalize(t,e,n){if(isFrozen(e))return e;const o=e[DRAFT_STATE];if(!o)return each(e,(l,d)=>finalizeProperty(t,o,e,l,d,n)),e;if(o.scope_!==t)return e;if(!o.modified_)return maybeFreeze(t,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const l=o.copy_;let d=l,f=!1;o.type_===3&&(d=new Set(l),l.clear(),f=!0),each(d,(g,b)=>finalizeProperty(t,o,l,g,b,n,f)),maybeFreeze(t,l,!1),n&&t.patches_&&getPlugin("Patches").generatePatches_(o,n,t.patches_,t.inversePatches_)}return o.copy_}function finalizeProperty(t,e,n,o,l,d,f){if(process.env.NODE_ENV!=="production"&&l===n&&die(5),isDraft(l)){const g=d&&e&&e.type_!==3&&!has$1(e.assigned_,o)?d.concat(o):void 0,b=finalize(t,l,g);if(set$1(n,o,b),isDraft(b))t.canAutoFreeze_=!1;else return}else f&&n.add(l);if(isDraftable(l)&&!isFrozen(l)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;finalize(t,l),(!e||!e.scope_.parent_)&&typeof o!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,o)&&maybeFreeze(t,l)}}function maybeFreeze(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&freeze(e,n)}function createProxyProxy(t,e){const n=Array.isArray(t),o={type_:n?1:0,scope_:e?e.scope_:getCurrentScope(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let l=o,d=objectTraps;n&&(l=[o],d=arrayTraps);const{revoke:f,proxy:g}=Proxy.revocable(l,d);return o.draft_=g,o.revoke_=f,g}var objectTraps={get(t,e){if(e===DRAFT_STATE)return t;const n=latest(t);if(!has$1(n,e))return readPropFromProto(t,n,e);const o=n[e];return t.finalized_||!isDraftable(o)?o:o===peek(t.base_,e)?(prepareCopy(t),t.copy_[e]=createProxy(o,t)):o},has(t,e){return e in latest(t)},ownKeys(t){return Reflect.ownKeys(latest(t))},set(t,e,n){const o=getDescriptorFromProto(latest(t),e);if(o!=null&&o.set)return o.set.call(t.draft_,n),!0;if(!t.modified_){const l=peek(latest(t),e),d=l==null?void 0:l[DRAFT_STATE];if(d&&d.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(is$1(n,l)&&(n!==void 0||has$1(t.base_,e)))return!0;prepareCopy(t),markChanged(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return peek(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,prepareCopy(t),markChanged(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=latest(t),o=Reflect.getOwnPropertyDescriptor(n,e);return o&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:o.enumerable,value:n[e]}},defineProperty(){die(11)},getPrototypeOf(t){return getPrototypeOf(t.base_)},setPrototypeOf(){die(12)}},arrayTraps={};each(objectTraps,(t,e)=>{arrayTraps[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}}),arrayTraps.deleteProperty=function(t,e){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(e))&&die(13),arrayTraps.set.call(this,t,e,void 0)},arrayTraps.set=function(t,e,n){return process.env.NODE_ENV!=="production"&&e!=="length"&&isNaN(parseInt(e))&&die(14),objectTraps.set.call(this,t[0],e,n,t[0])};function peek(t,e){const n=t[DRAFT_STATE];return(n?latest(n):t)[e]}function readPropFromProto(t,e,n){var l;const o=getDescriptorFromProto(e,n);return o?"value"in o?o.value:(l=o.get)==null?void 0:l.call(t.draft_):void 0}function getDescriptorFromProto(t,e){if(!(e in t))return;let n=getPrototypeOf(t);for(;n;){const o=Object.getOwnPropertyDescriptor(n,e);if(o)return o;n=getPrototypeOf(n)}}function markChanged(t){t.modified_||(t.modified_=!0,t.parent_&&markChanged(t.parent_))}function prepareCopy(t){t.copy_||(t.copy_=shallowCopy(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Immer2=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,n,o)=>{if(typeof e=="function"&&typeof n!="function"){const d=n;n=e;const f=this;return function(b=d,..._){return f.produce(b,S=>n.call(this,S,..._))}}typeof n!="function"&&die(6),o!==void 0&&typeof o!="function"&&die(7);let l;if(isDraftable(e)){const d=enterScope(this),f=createProxy(e,void 0);let g=!0;try{l=n(f),g=!1}finally{g?revokeScope(d):leaveScope(d)}return usePatchesInScope(d,o),processResult(l,d)}else if(!e||typeof e!="object"){if(l=n(e),l===void 0&&(l=e),l===NOTHING&&(l=void 0),this.autoFreeze_&&freeze(l,!0),o){const d=[],f=[];getPlugin("Patches").generateReplacementPatches_(e,l,d,f),o(d,f)}return l}else die(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(f,...g)=>this.produceWithPatches(f,b=>e(b,...g));let o,l;return[this.produce(e,n,(f,g)=>{o=f,l=g}),o,l]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){isDraftable(t)||die(8),isDraft(t)&&(t=current(t));const e=enterScope(this),n=createProxy(t,void 0);return n[DRAFT_STATE].isManual_=!0,leaveScope(e),n}finishDraft(t,e){const n=t&&t[DRAFT_STATE];(!n||!n.isManual_)&&die(9);const{scope_:o}=n;return usePatchesInScope(o,e),processResult(void 0,o)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const l=e[n];if(l.path.length===0&&l.op==="replace"){t=l.value;break}}n>-1&&(e=e.slice(n+1));const o=getPlugin("Patches").applyPatches_;return isDraft(t)?o(t,e):this.produce(t,l=>o(l,e))}};function createProxy(t,e){const n=isMap(t)?getPlugin("MapSet").proxyMap_(t,e):isSet(t)?getPlugin("MapSet").proxySet_(t,e):createProxyProxy(t,e);return(e?e.scope_:getCurrentScope()).drafts_.push(n),n}function current(t){return isDraft(t)||die(10,t),currentImpl(t)}function currentImpl(t){if(!isDraftable(t)||isFrozen(t))return t;const e=t[DRAFT_STATE];let n;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=shallowCopy(t,e.scope_.immer_.useStrictShallowCopy_)}else n=shallowCopy(t,!0);return each(n,(o,l)=>{set$1(n,o,currentImpl(l))}),e&&(e.finalized_=!1),n}function enablePatches(){process.env.NODE_ENV!=="production"&&errors.push('Sets cannot have "replace" patches.',function(C){return"Unsupported patch operation: "+C},function(C){return"Cannot apply patch, path doesn't resolve: "+C},"Patching reserved attributes like __proto__, prototype and constructor is not allowed");const e="replace",n="add",o="remove";function l(C,E,A,I){switch(C.type_){case 0:case 2:return f(C,E,A,I);case 1:return d(C,E,A,I);case 3:return g(C,E,A,I)}}function d(C,E,A,I){let{base_:M,assigned_:j}=C,q=C.copy_;q.length<M.length&&([M,q]=[q,M],[A,I]=[I,A]);for(let z=0;z<M.length;z++)if(j[z]&&q[z]!==M[z]){const Q=E.concat([z]);A.push({op:e,path:Q,value:R(q[z])}),I.push({op:e,path:Q,value:R(M[z])})}for(let z=M.length;z<q.length;z++){const Q=E.concat([z]);A.push({op:n,path:Q,value:R(q[z])})}for(let z=q.length-1;M.length<=z;--z){const Q=E.concat([z]);I.push({op:o,path:Q})}}function f(C,E,A,I){const{base_:M,copy_:j}=C;each(C.assigned_,(q,z)=>{const Q=get$2(M,q),F=get$2(j,q),O=z?has$1(M,q)?e:n:o;if(Q===F&&O===e)return;const te=E.concat(q);A.push(O===o?{op:O,path:te}:{op:O,path:te,value:F}),I.push(O===n?{op:o,path:te}:O===o?{op:n,path:te,value:R(Q)}:{op:e,path:te,value:R(Q)})})}function g(C,E,A,I){let{base_:M,copy_:j}=C,q=0;M.forEach(z=>{if(!j.has(z)){const Q=E.concat([q]);A.push({op:o,path:Q,value:z}),I.unshift({op:n,path:Q,value:z})}q++}),q=0,j.forEach(z=>{if(!M.has(z)){const Q=E.concat([q]);A.push({op:n,path:Q,value:z}),I.unshift({op:o,path:Q,value:z})}q++})}function b(C,E,A,I){A.push({op:e,path:[],value:E===NOTHING?void 0:E}),I.push({op:e,path:[],value:C})}function _(C,E){return E.forEach(A=>{const{path:I,op:M}=A;let j=C;for(let F=0;F<I.length-1;F++){const O=getArchtype(j);let te=I[F];typeof te!="string"&&typeof te!="number"&&(te=""+te),(O===0||O===1)&&(te==="__proto__"||te==="constructor")&&die(19),typeof j=="function"&&te==="prototype"&&die(19),j=get$2(j,te),typeof j!="object"&&die(18,I.join("/"))}const q=getArchtype(j),z=S(A.value),Q=I[I.length-1];switch(M){case e:switch(q){case 2:return j.set(Q,z);case 3:die(16);default:return j[Q]=z}case n:switch(q){case 1:return Q==="-"?j.push(z):j.splice(Q,0,z);case 2:return j.set(Q,z);case 3:return j.add(z);default:return j[Q]=z}case o:switch(q){case 1:return j.splice(Q,1);case 2:return j.delete(Q);case 3:return j.delete(A.value);default:return delete j[Q]}default:die(17,M)}}),C}function S(C){if(!isDraftable(C))return C;if(Array.isArray(C))return C.map(S);if(isMap(C))return new Map(Array.from(C.entries()).map(([A,I])=>[A,S(I)]));if(isSet(C))return new Set(Array.from(C).map(S));const E=Object.create(getPrototypeOf(C));for(const A in C)E[A]=S(C[A]);return has$1(C,DRAFTABLE)&&(E[DRAFTABLE]=C[DRAFTABLE]),E}function R(C){return isDraft(C)?S(C):C}loadPlugin("Patches",{applyPatches_:_,generatePatches_:l,generateReplacementPatches_:b})}var immer=new Immer2,produce=immer.produce,produceWithPatches=immer.produceWithPatches.bind(immer);immer.setAutoFreeze.bind(immer),immer.setUseStrictShallowCopy.bind(immer);var applyPatches=immer.applyPatches.bind(immer);immer.createDraft.bind(immer),immer.finishDraft.bind(immer);var runIdentityFunctionCheck=(t,e,n)=>{if(e.length===1&&e[0]===n){let o=!1;try{const l={};t(l)===l&&(o=!0)}catch{}if(o){let l;try{throw new Error}catch(d){({stack:l}=d)}console.warn(`The result function returned its own inputs without modification. e.g
459
+ For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return React__namespace.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},DESCRIPTION_WARNING_NAME="DialogDescriptionWarning",DescriptionWarning$1=({contentRef:t,descriptionId:e})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${useWarningContext(DESCRIPTION_WARNING_NAME).contentName}}.`;return React__namespace.useEffect(()=>{var d;const l=(d=t.current)==null?void 0:d.getAttribute("aria-describedby");e&&l&&(document.getElementById(e)||console.warn(o))},[o,t,e]),null},Root$8=Dialog$1,Trigger$5=DialogTrigger$1,Portal$4=DialogPortal$1,Overlay=DialogOverlay$1,Content$2=DialogContent$1,Title$1=DialogTitle$1,Description$1=DialogDescription$1,Close$1=DialogClose$1;const Dialog=({modal:t=!1,...e})=>jsxRuntime.jsx(Root$8,{modal:t,...e});Dialog.displayName=Root$8.displayName;const DialogTrigger=Trigger$5,DialogPortal=Portal$4,DialogClose=Close$1,DialogOverlay=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Overlay,{ref:n,className:cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));DialogOverlay.displayName=Overlay.displayName;const DialogContent=React__namespace.forwardRef(({className:t,children:e,animateExit:n=!0,...o},l)=>jsxRuntime.jsxs(DialogPortal,{forceMount:o.forceMount,children:[jsxRuntime.jsx(DialogOverlay,{}),jsxRuntime.jsxs(Content$2,{ref:l,className:cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-2xl shadow-primary duration-200 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n&&"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]",t),...o,children:[e,jsxRuntime.jsxs(Close$1,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[jsxRuntime.jsx(X$1,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));DialogContent.displayName=Content$2.displayName;const DialogHeader=({className:t,...e})=>jsxRuntime.jsx("div",{className:cn("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});DialogHeader.displayName="DialogHeader";const DialogFooter=({className:t,...e})=>jsxRuntime.jsx("div",{className:cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});DialogFooter.displayName="DialogFooter";const DialogTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Title$1,{ref:n,className:cn("text-lg font-semibold leading-none tracking-tight",t),...e}));DialogTitle.displayName=Title$1.displayName;const DialogDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Description$1,{ref:n,className:cn("text-sm text-muted-foreground",t),...e}));DialogDescription.displayName=Description$1.displayName;const sides=["top","right","bottom","left"],min$3=Math.min,max$3=Math.max,round$1=Math.round,floor=Math.floor,createCoords=t=>({x:t,y:t}),oppositeSideMap={left:"right",right:"left",bottom:"top",top:"bottom"},oppositeAlignmentMap={start:"end",end:"start"};function clamp$1(t,e,n){return max$3(t,min$3(e,n))}function evaluate(t,e){return typeof t=="function"?t(e):t}function getSide$1(t){return t.split("-")[0]}function getAlignment(t){return t.split("-")[1]}function getOppositeAxis(t){return t==="x"?"y":"x"}function getAxisLength(t){return t==="y"?"height":"width"}function getSideAxis(t){return["top","bottom"].includes(getSide$1(t))?"y":"x"}function getAlignmentAxis(t){return getOppositeAxis(getSideAxis(t))}function getAlignmentSides(t,e,n){n===void 0&&(n=!1);const o=getAlignment(t),l=getAlignmentAxis(t),d=getAxisLength(l);let f=l==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[d]>e.floating[d]&&(f=getOppositePlacement(f)),[f,getOppositePlacement(f)]}function getExpandedPlacements(t){const e=getOppositePlacement(t);return[getOppositeAlignmentPlacement(t),e,getOppositeAlignmentPlacement(e)]}function getOppositeAlignmentPlacement(t){return t.replace(/start|end/g,e=>oppositeAlignmentMap[e])}function getSideList(t,e,n){const o=["left","right"],l=["right","left"],d=["top","bottom"],f=["bottom","top"];switch(t){case"top":case"bottom":return n?e?l:o:e?o:l;case"left":case"right":return e?d:f;default:return[]}}function getOppositeAxisPlacements(t,e,n,o){const l=getAlignment(t);let d=getSideList(getSide$1(t),n==="start",o);return l&&(d=d.map(f=>f+"-"+l),e&&(d=d.concat(d.map(getOppositeAlignmentPlacement)))),d}function getOppositePlacement(t){return t.replace(/left|right|bottom|top/g,e=>oppositeSideMap[e])}function expandPaddingObject(t){return{top:0,right:0,bottom:0,left:0,...t}}function getPaddingObject(t){return typeof t!="number"?expandPaddingObject(t):{top:t,right:t,bottom:t,left:t}}function rectToClientRect(t){const{x:e,y:n,width:o,height:l}=t;return{width:o,height:l,top:n,left:e,right:e+o,bottom:n+l,x:e,y:n}}function computeCoordsFromPlacement(t,e,n){let{reference:o,floating:l}=t;const d=getSideAxis(e),f=getAlignmentAxis(e),g=getAxisLength(f),b=getSide$1(e),_=d==="y",S=o.x+o.width/2-l.width/2,R=o.y+o.height/2-l.height/2,C=o[g]/2-l[g]/2;let E;switch(b){case"top":E={x:S,y:o.y-l.height};break;case"bottom":E={x:S,y:o.y+o.height};break;case"right":E={x:o.x+o.width,y:R};break;case"left":E={x:o.x-l.width,y:R};break;default:E={x:o.x,y:o.y}}switch(getAlignment(e)){case"start":E[f]-=C*(n&&_?-1:1);break;case"end":E[f]+=C*(n&&_?-1:1);break}return E}const computePosition$1=async(t,e,n)=>{const{placement:o="bottom",strategy:l="absolute",middleware:d=[],platform:f}=n,g=d.filter(Boolean),b=await(f.isRTL==null?void 0:f.isRTL(e));let _=await f.getElementRects({reference:t,floating:e,strategy:l}),{x:S,y:R}=computeCoordsFromPlacement(_,o,b),C=o,E={},A=0;for(let I=0;I<g.length;I++){const{name:M,fn:j}=g[I],{x:q,y:z,data:Q,reset:F}=await j({x:S,y:R,initialPlacement:o,placement:C,strategy:l,middlewareData:E,rects:_,platform:f,elements:{reference:t,floating:e}});S=q??S,R=z??R,E={...E,[M]:{...E[M],...Q}},F&&A<=50&&(A++,typeof F=="object"&&(F.placement&&(C=F.placement),F.rects&&(_=F.rects===!0?await f.getElementRects({reference:t,floating:e,strategy:l}):F.rects),{x:S,y:R}=computeCoordsFromPlacement(_,C,b)),I=-1)}return{x:S,y:R,placement:C,strategy:l,middlewareData:E}};async function detectOverflow(t,e){var n;e===void 0&&(e={});const{x:o,y:l,platform:d,rects:f,elements:g,strategy:b}=t,{boundary:_="clippingAncestors",rootBoundary:S="viewport",elementContext:R="floating",altBoundary:C=!1,padding:E=0}=evaluate(e,t),A=getPaddingObject(E),M=g[C?R==="floating"?"reference":"floating":R],j=rectToClientRect(await d.getClippingRect({element:(n=await(d.isElement==null?void 0:d.isElement(M)))==null||n?M:M.contextElement||await(d.getDocumentElement==null?void 0:d.getDocumentElement(g.floating)),boundary:_,rootBoundary:S,strategy:b})),q=R==="floating"?{x:o,y:l,width:f.floating.width,height:f.floating.height}:f.reference,z=await(d.getOffsetParent==null?void 0:d.getOffsetParent(g.floating)),Q=await(d.isElement==null?void 0:d.isElement(z))?await(d.getScale==null?void 0:d.getScale(z))||{x:1,y:1}:{x:1,y:1},F=rectToClientRect(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:g,rect:q,offsetParent:z,strategy:b}):q);return{top:(j.top-F.top+A.top)/Q.y,bottom:(F.bottom-j.bottom+A.bottom)/Q.y,left:(j.left-F.left+A.left)/Q.x,right:(F.right-j.right+A.right)/Q.x}}const arrow$4=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:l,rects:d,platform:f,elements:g,middlewareData:b}=e,{element:_,padding:S=0}=evaluate(t,e)||{};if(_==null)return{};const R=getPaddingObject(S),C={x:n,y:o},E=getAlignmentAxis(l),A=getAxisLength(E),I=await f.getDimensions(_),M=E==="y",j=M?"top":"left",q=M?"bottom":"right",z=M?"clientHeight":"clientWidth",Q=d.reference[A]+d.reference[E]-C[E]-d.floating[A],F=C[E]-d.reference[E],O=await(f.getOffsetParent==null?void 0:f.getOffsetParent(_));let te=O?O[z]:0;(!te||!await(f.isElement==null?void 0:f.isElement(O)))&&(te=g.floating[z]||d.floating[A]);const ne=Q/2-F/2,ae=te/2-I[A]/2-1,ge=min$3(R[j],ae),oe=min$3(R[q],ae),je=ge,Ne=te-I[A]-oe,Ae=te/2-I[A]/2+ne,$e=clamp$1(je,Ae,Ne),Fe=!b.arrow&&getAlignment(l)!=null&&Ae!==$e&&d.reference[A]/2-(Ae<je?ge:oe)-I[A]/2<0,ze=Fe?Ae<je?Ae-je:Ae-Ne:0;return{[E]:C[E]+ze,data:{[E]:$e,centerOffset:Ae-$e-ze,...Fe&&{alignmentOffset:ze}},reset:Fe}}}),flip$2=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:l,middlewareData:d,rects:f,initialPlacement:g,platform:b,elements:_}=e,{mainAxis:S=!0,crossAxis:R=!0,fallbackPlacements:C,fallbackStrategy:E="bestFit",fallbackAxisSideDirection:A="none",flipAlignment:I=!0,...M}=evaluate(t,e);if((n=d.arrow)!=null&&n.alignmentOffset)return{};const j=getSide$1(l),q=getSideAxis(g),z=getSide$1(g)===g,Q=await(b.isRTL==null?void 0:b.isRTL(_.floating)),F=C||(z||!I?[getOppositePlacement(g)]:getExpandedPlacements(g)),O=A!=="none";!C&&O&&F.push(...getOppositeAxisPlacements(g,I,A,Q));const te=[g,...F],ne=await detectOverflow(e,M),ae=[];let ge=((o=d.flip)==null?void 0:o.overflows)||[];if(S&&ae.push(ne[j]),R){const Ae=getAlignmentSides(l,f,Q);ae.push(ne[Ae[0]],ne[Ae[1]])}if(ge=[...ge,{placement:l,overflows:ae}],!ae.every(Ae=>Ae<=0)){var oe,je;const Ae=(((oe=d.flip)==null?void 0:oe.index)||0)+1,$e=te[Ae];if($e&&(!(R==="alignment"?q!==getSideAxis($e):!1)||ge.every(Ve=>Ve.overflows[0]>0&&getSideAxis(Ve.placement)===q)))return{data:{index:Ae,overflows:ge},reset:{placement:$e}};let Fe=(je=ge.filter(ze=>ze.overflows[0]<=0).sort((ze,Ve)=>ze.overflows[1]-Ve.overflows[1])[0])==null?void 0:je.placement;if(!Fe)switch(E){case"bestFit":{var Ne;const ze=(Ne=ge.filter(Ve=>{if(O){const Be=getSideAxis(Ve.placement);return Be===q||Be==="y"}return!0}).map(Ve=>[Ve.placement,Ve.overflows.filter(Be=>Be>0).reduce((Be,qe)=>Be+qe,0)]).sort((Ve,Be)=>Ve[1]-Be[1])[0])==null?void 0:Ne[0];ze&&(Fe=ze);break}case"initialPlacement":Fe=g;break}if(l!==Fe)return{reset:{placement:Fe}}}return{}}}};function getSideOffsets(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function isAnySideFullyClipped(t){return sides.some(e=>t[e]>=0)}const hide$2=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:o="referenceHidden",...l}=evaluate(t,e);switch(o){case"referenceHidden":{const d=await detectOverflow(e,{...l,elementContext:"reference"}),f=getSideOffsets(d,n.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:isAnySideFullyClipped(f)}}}case"escaped":{const d=await detectOverflow(e,{...l,altBoundary:!0}),f=getSideOffsets(d,n.floating);return{data:{escapedOffsets:f,escaped:isAnySideFullyClipped(f)}}}default:return{}}}}};async function convertValueToCoords(t,e){const{placement:n,platform:o,elements:l}=t,d=await(o.isRTL==null?void 0:o.isRTL(l.floating)),f=getSide$1(n),g=getAlignment(n),b=getSideAxis(n)==="y",_=["left","top"].includes(f)?-1:1,S=d&&b?-1:1,R=evaluate(e,t);let{mainAxis:C,crossAxis:E,alignmentAxis:A}=typeof R=="number"?{mainAxis:R,crossAxis:0,alignmentAxis:null}:{mainAxis:R.mainAxis||0,crossAxis:R.crossAxis||0,alignmentAxis:R.alignmentAxis};return g&&typeof A=="number"&&(E=g==="end"?A*-1:A),b?{x:E*S,y:C*_}:{x:C*_,y:E*S}}const offset$2=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:l,y:d,placement:f,middlewareData:g}=e,b=await convertValueToCoords(e,t);return f===((n=g.offset)==null?void 0:n.placement)&&(o=g.arrow)!=null&&o.alignmentOffset?{}:{x:l+b.x,y:d+b.y,data:{...b,placement:f}}}}},shift$3=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:l}=e,{mainAxis:d=!0,crossAxis:f=!1,limiter:g={fn:M=>{let{x:j,y:q}=M;return{x:j,y:q}}},...b}=evaluate(t,e),_={x:n,y:o},S=await detectOverflow(e,b),R=getSideAxis(getSide$1(l)),C=getOppositeAxis(R);let E=_[C],A=_[R];if(d){const M=C==="y"?"top":"left",j=C==="y"?"bottom":"right",q=E+S[M],z=E-S[j];E=clamp$1(q,E,z)}if(f){const M=R==="y"?"top":"left",j=R==="y"?"bottom":"right",q=A+S[M],z=A-S[j];A=clamp$1(q,A,z)}const I=g.fn({...e,[C]:E,[R]:A});return{...I,data:{x:I.x-n,y:I.y-o,enabled:{[C]:d,[R]:f}}}}}},limitShift$2=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:l,rects:d,middlewareData:f}=e,{offset:g=0,mainAxis:b=!0,crossAxis:_=!0}=evaluate(t,e),S={x:n,y:o},R=getSideAxis(l),C=getOppositeAxis(R);let E=S[C],A=S[R];const I=evaluate(g,e),M=typeof I=="number"?{mainAxis:I,crossAxis:0}:{mainAxis:0,crossAxis:0,...I};if(b){const z=C==="y"?"height":"width",Q=d.reference[C]-d.floating[z]+M.mainAxis,F=d.reference[C]+d.reference[z]-M.mainAxis;E<Q?E=Q:E>F&&(E=F)}if(_){var j,q;const z=C==="y"?"width":"height",Q=["top","left"].includes(getSide$1(l)),F=d.reference[R]-d.floating[z]+(Q&&((j=f.offset)==null?void 0:j[R])||0)+(Q?0:M.crossAxis),O=d.reference[R]+d.reference[z]+(Q?0:((q=f.offset)==null?void 0:q[R])||0)-(Q?M.crossAxis:0);A<F?A=F:A>O&&(A=O)}return{[C]:E,[R]:A}}}},size$2=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:l,rects:d,platform:f,elements:g}=e,{apply:b=()=>{},..._}=evaluate(t,e),S=await detectOverflow(e,_),R=getSide$1(l),C=getAlignment(l),E=getSideAxis(l)==="y",{width:A,height:I}=d.floating;let M,j;R==="top"||R==="bottom"?(M=R,j=C===(await(f.isRTL==null?void 0:f.isRTL(g.floating))?"start":"end")?"left":"right"):(j=R,M=C==="end"?"top":"bottom");const q=I-S.top-S.bottom,z=A-S.left-S.right,Q=min$3(I-S[M],q),F=min$3(A-S[j],z),O=!e.middlewareData.shift;let te=Q,ne=F;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(ne=z),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(te=q),O&&!C){const ge=max$3(S.left,0),oe=max$3(S.right,0),je=max$3(S.top,0),Ne=max$3(S.bottom,0);E?ne=A-2*(ge!==0||oe!==0?ge+oe:max$3(S.left,S.right)):te=I-2*(je!==0||Ne!==0?je+Ne:max$3(S.top,S.bottom))}await b({...e,availableWidth:ne,availableHeight:te});const ae=await f.getDimensions(g.floating);return A!==ae.width||I!==ae.height?{reset:{rects:!0}}:{}}}};function hasWindow(){return typeof window<"u"}function getNodeName(t){return isNode(t)?(t.nodeName||"").toLowerCase():"#document"}function getWindow(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function getDocumentElement(t){var e;return(e=(isNode(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function isNode(t){return hasWindow()?t instanceof Node||t instanceof getWindow(t).Node:!1}function isElement(t){return hasWindow()?t instanceof Element||t instanceof getWindow(t).Element:!1}function isHTMLElement$2(t){return hasWindow()?t instanceof HTMLElement||t instanceof getWindow(t).HTMLElement:!1}function isShadowRoot(t){return!hasWindow()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof getWindow(t).ShadowRoot}function isOverflowElement(t){const{overflow:e,overflowX:n,overflowY:o,display:l}=getComputedStyle$1(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(l)}function isTableElement(t){return["table","td","th"].includes(getNodeName(t))}function isTopLayer(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function isContainingBlock(t){const e=isWebKit(),n=isElement(t)?getComputedStyle$1(t):t;return["transform","translate","scale","rotate","perspective"].some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(o=>(n.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(n.contain||"").includes(o))}function getContainingBlock(t){let e=getParentNode(t);for(;isHTMLElement$2(e)&&!isLastTraversableNode(e);){if(isContainingBlock(e))return e;if(isTopLayer(e))return null;e=getParentNode(e)}return null}function isWebKit(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function isLastTraversableNode(t){return["html","body","#document"].includes(getNodeName(t))}function getComputedStyle$1(t){return getWindow(t).getComputedStyle(t)}function getNodeScroll(t){return isElement(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function getParentNode(t){if(getNodeName(t)==="html")return t;const e=t.assignedSlot||t.parentNode||isShadowRoot(t)&&t.host||getDocumentElement(t);return isShadowRoot(e)?e.host:e}function getNearestOverflowAncestor(t){const e=getParentNode(t);return isLastTraversableNode(e)?t.ownerDocument?t.ownerDocument.body:t.body:isHTMLElement$2(e)&&isOverflowElement(e)?e:getNearestOverflowAncestor(e)}function getOverflowAncestors(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const l=getNearestOverflowAncestor(t),d=l===((o=t.ownerDocument)==null?void 0:o.body),f=getWindow(l);if(d){const g=getFrameElement(f);return e.concat(f,f.visualViewport||[],isOverflowElement(l)?l:[],g&&n?getOverflowAncestors(g):[])}return e.concat(l,getOverflowAncestors(l,[],n))}function getFrameElement(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function getCssDimensions(t){const e=getComputedStyle$1(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const l=isHTMLElement$2(t),d=l?t.offsetWidth:n,f=l?t.offsetHeight:o,g=round$1(n)!==d||round$1(o)!==f;return g&&(n=d,o=f),{width:n,height:o,$:g}}function unwrapElement(t){return isElement(t)?t:t.contextElement}function getScale(t){const e=unwrapElement(t);if(!isHTMLElement$2(e))return createCoords(1);const n=e.getBoundingClientRect(),{width:o,height:l,$:d}=getCssDimensions(e);let f=(d?round$1(n.width):n.width)/o,g=(d?round$1(n.height):n.height)/l;return(!f||!Number.isFinite(f))&&(f=1),(!g||!Number.isFinite(g))&&(g=1),{x:f,y:g}}const noOffsets=createCoords(0);function getVisualOffsets(t){const e=getWindow(t);return!isWebKit()||!e.visualViewport?noOffsets:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function shouldAddVisualOffsets(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==getWindow(t)?!1:e}function getBoundingClientRect(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const l=t.getBoundingClientRect(),d=unwrapElement(t);let f=createCoords(1);e&&(o?isElement(o)&&(f=getScale(o)):f=getScale(t));const g=shouldAddVisualOffsets(d,n,o)?getVisualOffsets(d):createCoords(0);let b=(l.left+g.x)/f.x,_=(l.top+g.y)/f.y,S=l.width/f.x,R=l.height/f.y;if(d){const C=getWindow(d),E=o&&isElement(o)?getWindow(o):o;let A=C,I=getFrameElement(A);for(;I&&o&&E!==A;){const M=getScale(I),j=I.getBoundingClientRect(),q=getComputedStyle$1(I),z=j.left+(I.clientLeft+parseFloat(q.paddingLeft))*M.x,Q=j.top+(I.clientTop+parseFloat(q.paddingTop))*M.y;b*=M.x,_*=M.y,S*=M.x,R*=M.y,b+=z,_+=Q,A=getWindow(I),I=getFrameElement(A)}}return rectToClientRect({width:S,height:R,x:b,y:_})}function getWindowScrollBarX(t,e){const n=getNodeScroll(t).scrollLeft;return e?e.left+n:getBoundingClientRect(getDocumentElement(t)).left+n}function getHTMLOffset(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),l=o.left+e.scrollLeft-(n?0:getWindowScrollBarX(t,o)),d=o.top+e.scrollTop;return{x:l,y:d}}function convertOffsetParentRelativeRectToViewportRelativeRect(t){let{elements:e,rect:n,offsetParent:o,strategy:l}=t;const d=l==="fixed",f=getDocumentElement(o),g=e?isTopLayer(e.floating):!1;if(o===f||g&&d)return n;let b={scrollLeft:0,scrollTop:0},_=createCoords(1);const S=createCoords(0),R=isHTMLElement$2(o);if((R||!R&&!d)&&((getNodeName(o)!=="body"||isOverflowElement(f))&&(b=getNodeScroll(o)),isHTMLElement$2(o))){const E=getBoundingClientRect(o);_=getScale(o),S.x=E.x+o.clientLeft,S.y=E.y+o.clientTop}const C=f&&!R&&!d?getHTMLOffset(f,b,!0):createCoords(0);return{width:n.width*_.x,height:n.height*_.y,x:n.x*_.x-b.scrollLeft*_.x+S.x+C.x,y:n.y*_.y-b.scrollTop*_.y+S.y+C.y}}function getClientRects(t){return Array.from(t.getClientRects())}function getDocumentRect(t){const e=getDocumentElement(t),n=getNodeScroll(t),o=t.ownerDocument.body,l=max$3(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),d=max$3(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let f=-n.scrollLeft+getWindowScrollBarX(t);const g=-n.scrollTop;return getComputedStyle$1(o).direction==="rtl"&&(f+=max$3(e.clientWidth,o.clientWidth)-l),{width:l,height:d,x:f,y:g}}function getViewportRect(t,e){const n=getWindow(t),o=getDocumentElement(t),l=n.visualViewport;let d=o.clientWidth,f=o.clientHeight,g=0,b=0;if(l){d=l.width,f=l.height;const _=isWebKit();(!_||_&&e==="fixed")&&(g=l.offsetLeft,b=l.offsetTop)}return{width:d,height:f,x:g,y:b}}function getInnerBoundingClientRect(t,e){const n=getBoundingClientRect(t,!0,e==="fixed"),o=n.top+t.clientTop,l=n.left+t.clientLeft,d=isHTMLElement$2(t)?getScale(t):createCoords(1),f=t.clientWidth*d.x,g=t.clientHeight*d.y,b=l*d.x,_=o*d.y;return{width:f,height:g,x:b,y:_}}function getClientRectFromClippingAncestor(t,e,n){let o;if(e==="viewport")o=getViewportRect(t,n);else if(e==="document")o=getDocumentRect(getDocumentElement(t));else if(isElement(e))o=getInnerBoundingClientRect(e,n);else{const l=getVisualOffsets(t);o={x:e.x-l.x,y:e.y-l.y,width:e.width,height:e.height}}return rectToClientRect(o)}function hasFixedPositionAncestor(t,e){const n=getParentNode(t);return n===e||!isElement(n)||isLastTraversableNode(n)?!1:getComputedStyle$1(n).position==="fixed"||hasFixedPositionAncestor(n,e)}function getClippingElementAncestors(t,e){const n=e.get(t);if(n)return n;let o=getOverflowAncestors(t,[],!1).filter(g=>isElement(g)&&getNodeName(g)!=="body"),l=null;const d=getComputedStyle$1(t).position==="fixed";let f=d?getParentNode(t):t;for(;isElement(f)&&!isLastTraversableNode(f);){const g=getComputedStyle$1(f),b=isContainingBlock(f);!b&&g.position==="fixed"&&(l=null),(d?!b&&!l:!b&&g.position==="static"&&!!l&&["absolute","fixed"].includes(l.position)||isOverflowElement(f)&&!b&&hasFixedPositionAncestor(t,f))?o=o.filter(S=>S!==f):l=g,f=getParentNode(f)}return e.set(t,o),o}function getClippingRect(t){let{element:e,boundary:n,rootBoundary:o,strategy:l}=t;const f=[...n==="clippingAncestors"?isTopLayer(e)?[]:getClippingElementAncestors(e,this._c):[].concat(n),o],g=f[0],b=f.reduce((_,S)=>{const R=getClientRectFromClippingAncestor(e,S,l);return _.top=max$3(R.top,_.top),_.right=min$3(R.right,_.right),_.bottom=min$3(R.bottom,_.bottom),_.left=max$3(R.left,_.left),_},getClientRectFromClippingAncestor(e,g,l));return{width:b.right-b.left,height:b.bottom-b.top,x:b.left,y:b.top}}function getDimensions(t){const{width:e,height:n}=getCssDimensions(t);return{width:e,height:n}}function getRectRelativeToOffsetParent(t,e,n){const o=isHTMLElement$2(e),l=getDocumentElement(e),d=n==="fixed",f=getBoundingClientRect(t,!0,d,e);let g={scrollLeft:0,scrollTop:0};const b=createCoords(0);function _(){b.x=getWindowScrollBarX(l)}if(o||!o&&!d)if((getNodeName(e)!=="body"||isOverflowElement(l))&&(g=getNodeScroll(e)),o){const E=getBoundingClientRect(e,!0,d,e);b.x=E.x+e.clientLeft,b.y=E.y+e.clientTop}else l&&_();d&&!o&&l&&_();const S=l&&!o&&!d?getHTMLOffset(l,g):createCoords(0),R=f.left+g.scrollLeft-b.x-S.x,C=f.top+g.scrollTop-b.y-S.y;return{x:R,y:C,width:f.width,height:f.height}}function isStaticPositioned(t){return getComputedStyle$1(t).position==="static"}function getTrueOffsetParent(t,e){if(!isHTMLElement$2(t)||getComputedStyle$1(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return getDocumentElement(t)===n&&(n=n.ownerDocument.body),n}function getOffsetParent(t,e){const n=getWindow(t);if(isTopLayer(t))return n;if(!isHTMLElement$2(t)){let l=getParentNode(t);for(;l&&!isLastTraversableNode(l);){if(isElement(l)&&!isStaticPositioned(l))return l;l=getParentNode(l)}return n}let o=getTrueOffsetParent(t,e);for(;o&&isTableElement(o)&&isStaticPositioned(o);)o=getTrueOffsetParent(o,e);return o&&isLastTraversableNode(o)&&isStaticPositioned(o)&&!isContainingBlock(o)?n:o||getContainingBlock(t)||n}const getElementRects=async function(t){const e=this.getOffsetParent||getOffsetParent,n=this.getDimensions,o=await n(t.floating);return{reference:getRectRelativeToOffsetParent(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function isRTL(t){return getComputedStyle$1(t).direction==="rtl"}const platform={convertOffsetParentRelativeRectToViewportRelativeRect,getDocumentElement,getClippingRect,getOffsetParent,getElementRects,getClientRects,getDimensions,getScale,isElement,isRTL};function rectsAreEqual(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function observeMove(t,e){let n=null,o;const l=getDocumentElement(t);function d(){var g;clearTimeout(o),(g=n)==null||g.disconnect(),n=null}function f(g,b){g===void 0&&(g=!1),b===void 0&&(b=1),d();const _=t.getBoundingClientRect(),{left:S,top:R,width:C,height:E}=_;if(g||e(),!C||!E)return;const A=floor(R),I=floor(l.clientWidth-(S+C)),M=floor(l.clientHeight-(R+E)),j=floor(S),z={rootMargin:-A+"px "+-I+"px "+-M+"px "+-j+"px",threshold:max$3(0,min$3(1,b))||1};let Q=!0;function F(O){const te=O[0].intersectionRatio;if(te!==b){if(!Q)return f();te?f(!1,te):o=setTimeout(()=>{f(!1,1e-7)},1e3)}te===1&&!rectsAreEqual(_,t.getBoundingClientRect())&&f(),Q=!1}try{n=new IntersectionObserver(F,{...z,root:l.ownerDocument})}catch{n=new IntersectionObserver(F,z)}n.observe(t)}return f(!0),d}function autoUpdate(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:l=!0,ancestorResize:d=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:g=typeof IntersectionObserver=="function",animationFrame:b=!1}=o,_=unwrapElement(t),S=l||d?[..._?getOverflowAncestors(_):[],...getOverflowAncestors(e)]:[];S.forEach(j=>{l&&j.addEventListener("scroll",n,{passive:!0}),d&&j.addEventListener("resize",n)});const R=_&&g?observeMove(_,n):null;let C=-1,E=null;f&&(E=new ResizeObserver(j=>{let[q]=j;q&&q.target===_&&E&&(E.unobserve(e),cancelAnimationFrame(C),C=requestAnimationFrame(()=>{var z;(z=E)==null||z.observe(e)})),n()}),_&&!b&&E.observe(_),E.observe(e));let A,I=b?getBoundingClientRect(t):null;b&&M();function M(){const j=getBoundingClientRect(t);I&&!rectsAreEqual(I,j)&&n(),I=j,A=requestAnimationFrame(M)}return n(),()=>{var j;S.forEach(q=>{l&&q.removeEventListener("scroll",n),d&&q.removeEventListener("resize",n)}),R==null||R(),(j=E)==null||j.disconnect(),E=null,b&&cancelAnimationFrame(A)}}const offset$1=offset$2,shift$2=shift$3,flip$1=flip$2,size$1=size$2,hide$1=hide$2,arrow$3=arrow$4,limitShift$1=limitShift$2,computePosition=(t,e,n)=>{const o=new Map,l={platform,...n},d={...l.platform,_c:o};return computePosition$1(t,e,{...l,platform:d})};var isClient=typeof document<"u",noop$2=function(){},index=isClient?React.useLayoutEffect:noop$2;function deepEqual$3(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,o,l;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(o=n;o--!==0;)if(!deepEqual$3(t[o],e[o]))return!1;return!0}if(l=Object.keys(t),n=l.length,n!==Object.keys(e).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(e,l[o]))return!1;for(o=n;o--!==0;){const d=l[o];if(!(d==="_owner"&&t.$$typeof)&&!deepEqual$3(t[d],e[d]))return!1}return!0}return t!==t&&e!==e}function getDPR(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function roundByDPR(t,e){const n=getDPR(t);return Math.round(e*n)/n}function useLatestRef(t){const e=React__namespace.useRef(t);return index(()=>{e.current=t}),e}function useFloating(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:o=[],platform:l,elements:{reference:d,floating:f}={},transform:g=!0,whileElementsMounted:b,open:_}=t,[S,R]=React__namespace.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[C,E]=React__namespace.useState(o);deepEqual$3(C,o)||E(o);const[A,I]=React__namespace.useState(null),[M,j]=React__namespace.useState(null),q=React__namespace.useCallback(Ve=>{Ve!==O.current&&(O.current=Ve,I(Ve))},[]),z=React__namespace.useCallback(Ve=>{Ve!==te.current&&(te.current=Ve,j(Ve))},[]),Q=d||A,F=f||M,O=React__namespace.useRef(null),te=React__namespace.useRef(null),ne=React__namespace.useRef(S),ae=b!=null,ge=useLatestRef(b),oe=useLatestRef(l),je=useLatestRef(_),Ne=React__namespace.useCallback(()=>{if(!O.current||!te.current)return;const Ve={placement:e,strategy:n,middleware:C};oe.current&&(Ve.platform=oe.current),computePosition(O.current,te.current,Ve).then(Be=>{const qe={...Be,isPositioned:je.current!==!1};Ae.current&&!deepEqual$3(ne.current,qe)&&(ne.current=qe,ReactDOM__namespace.flushSync(()=>{R(qe)}))})},[C,e,n,oe,je]);index(()=>{_===!1&&ne.current.isPositioned&&(ne.current.isPositioned=!1,R(Ve=>({...Ve,isPositioned:!1})))},[_]);const Ae=React__namespace.useRef(!1);index(()=>(Ae.current=!0,()=>{Ae.current=!1}),[]),index(()=>{if(Q&&(O.current=Q),F&&(te.current=F),Q&&F){if(ge.current)return ge.current(Q,F,Ne);Ne()}},[Q,F,Ne,ge,ae]);const $e=React__namespace.useMemo(()=>({reference:O,floating:te,setReference:q,setFloating:z}),[q,z]),Fe=React__namespace.useMemo(()=>({reference:Q,floating:F}),[Q,F]),ze=React__namespace.useMemo(()=>{const Ve={position:n,left:0,top:0};if(!Fe.floating)return Ve;const Be=roundByDPR(Fe.floating,S.x),qe=roundByDPR(Fe.floating,S.y);return g?{...Ve,transform:"translate("+Be+"px, "+qe+"px)",...getDPR(Fe.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Be,top:qe}},[n,g,Fe.floating,S.x,S.y]);return React__namespace.useMemo(()=>({...S,update:Ne,refs:$e,elements:Fe,floatingStyles:ze}),[S,Ne,$e,Fe,ze])}const arrow$1=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:o,padding:l}=typeof t=="function"?t(n):t;return o&&e(o)?o.current!=null?arrow$3({element:o.current,padding:l}).fn(n):{}:o?arrow$3({element:o,padding:l}).fn(n):{}}}},offset=(t,e)=>({...offset$1(t),options:[t,e]}),shift$1=(t,e)=>({...shift$2(t),options:[t,e]}),limitShift=(t,e)=>({...limitShift$1(t),options:[t,e]}),flip=(t,e)=>({...flip$1(t),options:[t,e]}),size=(t,e)=>({...size$1(t),options:[t,e]}),hide=(t,e)=>({...hide$1(t),options:[t,e]}),arrow$2=(t,e)=>({...arrow$1(t),options:[t,e]});var NAME$3="Arrow",Arrow$1=React__namespace.forwardRef((t,e)=>{const{children:n,width:o=10,height:l=5,...d}=t;return jsxRuntime.jsx(Primitive.svg,{...d,ref:e,width:o,height:l,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:jsxRuntime.jsx("polygon",{points:"0,0 30,0 15,10"})})});Arrow$1.displayName=NAME$3;var Root$7=Arrow$1,POPPER_NAME="Popper",[createPopperContext,createPopperScope]=createContextScope(POPPER_NAME),[PopperProvider,usePopperContext]=createPopperContext(POPPER_NAME),Popper=t=>{const{__scopePopper:e,children:n}=t,[o,l]=React__namespace.useState(null);return jsxRuntime.jsx(PopperProvider,{scope:e,anchor:o,onAnchorChange:l,children:n})};Popper.displayName=POPPER_NAME;var ANCHOR_NAME$2="PopperAnchor",PopperAnchor=React__namespace.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:o,...l}=t,d=usePopperContext(ANCHOR_NAME$2,n),f=React__namespace.useRef(null),g=useComposedRefs(e,f);return React__namespace.useEffect(()=>{d.onAnchorChange((o==null?void 0:o.current)||f.current)}),o?null:jsxRuntime.jsx(Primitive.div,{...l,ref:g})});PopperAnchor.displayName=ANCHOR_NAME$2;var CONTENT_NAME$7="PopperContent",[PopperContentProvider,useContentContext]=createPopperContext(CONTENT_NAME$7),PopperContent=React__namespace.forwardRef((t,e)=>{var Ze,at,rt,it,st,Ue;const{__scopePopper:n,side:o="bottom",sideOffset:l=0,align:d="center",alignOffset:f=0,arrowPadding:g=0,avoidCollisions:b=!0,collisionBoundary:_=[],collisionPadding:S=0,sticky:R="partial",hideWhenDetached:C=!1,updatePositionStrategy:E="optimized",onPlaced:A,...I}=t,M=usePopperContext(CONTENT_NAME$7,n),[j,q]=React__namespace.useState(null),z=useComposedRefs(e,Rt=>q(Rt)),[Q,F]=React__namespace.useState(null),O=useSize(Q),te=(O==null?void 0:O.width)??0,ne=(O==null?void 0:O.height)??0,ae=o+(d!=="center"?"-"+d:""),ge=typeof S=="number"?S:{top:0,right:0,bottom:0,left:0,...S},oe=Array.isArray(_)?_:[_],je=oe.length>0,Ne={padding:ge,boundary:oe.filter(isNotNull),altBoundary:je},{refs:Ae,floatingStyles:$e,placement:Fe,isPositioned:ze,middlewareData:Ve}=useFloating({strategy:"fixed",placement:ae,whileElementsMounted:(...Rt)=>autoUpdate(...Rt,{animationFrame:E==="always"}),elements:{reference:M.anchor},middleware:[offset({mainAxis:l+ne,alignmentAxis:f}),b&&shift$1({mainAxis:!0,crossAxis:!1,limiter:R==="partial"?limitShift():void 0,...Ne}),b&&flip({...Ne}),size({...Ne,apply:({elements:Rt,rects:Je,availableWidth:mt,availableHeight:$t})=>{const{width:Dt,height:Ht}=Je.reference,Vt=Rt.floating.style;Vt.setProperty("--radix-popper-available-width",`${mt}px`),Vt.setProperty("--radix-popper-available-height",`${$t}px`),Vt.setProperty("--radix-popper-anchor-width",`${Dt}px`),Vt.setProperty("--radix-popper-anchor-height",`${Ht}px`)}}),Q&&arrow$2({element:Q,padding:g}),transformOrigin({arrowWidth:te,arrowHeight:ne}),C&&hide({strategy:"referenceHidden",...Ne})]}),[Be,qe]=getSideAndAlignFromPlacement(Fe),Ke=useCallbackRef$1(A);useLayoutEffect2(()=>{ze&&(Ke==null||Ke())},[ze,Ke]);const He=(Ze=Ve.arrow)==null?void 0:Ze.x,Xe=(at=Ve.arrow)==null?void 0:at.y,tt=((rt=Ve.arrow)==null?void 0:rt.centerOffset)!==0,[Ye,et]=React__namespace.useState();return useLayoutEffect2(()=>{j&&et(window.getComputedStyle(j).zIndex)},[j]),jsxRuntime.jsx("div",{ref:Ae.setFloating,"data-radix-popper-content-wrapper":"",style:{...$e,transform:ze?$e.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ye,"--radix-popper-transform-origin":[(it=Ve.transformOrigin)==null?void 0:it.x,(st=Ve.transformOrigin)==null?void 0:st.y].join(" "),...((Ue=Ve.hide)==null?void 0:Ue.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:jsxRuntime.jsx(PopperContentProvider,{scope:n,placedSide:Be,onArrowChange:F,arrowX:He,arrowY:Xe,shouldHideArrow:tt,children:jsxRuntime.jsx(Primitive.div,{"data-side":Be,"data-align":qe,...I,ref:z,style:{...I.style,animation:ze?void 0:"none"}})})})});PopperContent.displayName=CONTENT_NAME$7;var ARROW_NAME$5="PopperArrow",OPPOSITE_SIDE={top:"bottom",right:"left",bottom:"top",left:"right"},PopperArrow=React__namespace.forwardRef(function(e,n){const{__scopePopper:o,...l}=e,d=useContentContext(ARROW_NAME$5,o),f=OPPOSITE_SIDE[d.placedSide];return jsxRuntime.jsx("span",{ref:d.onArrowChange,style:{position:"absolute",left:d.arrowX,top:d.arrowY,[f]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[d.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[d.placedSide],visibility:d.shouldHideArrow?"hidden":void 0},children:jsxRuntime.jsx(Root$7,{...l,ref:n,style:{...l.style,display:"block"}})})});PopperArrow.displayName=ARROW_NAME$5;function isNotNull(t){return t!==null}var transformOrigin=t=>({name:"transformOrigin",options:t,fn(e){var M,j,q;const{placement:n,rects:o,middlewareData:l}=e,f=((M=l.arrow)==null?void 0:M.centerOffset)!==0,g=f?0:t.arrowWidth,b=f?0:t.arrowHeight,[_,S]=getSideAndAlignFromPlacement(n),R={start:"0%",center:"50%",end:"100%"}[S],C=(((j=l.arrow)==null?void 0:j.x)??0)+g/2,E=(((q=l.arrow)==null?void 0:q.y)??0)+b/2;let A="",I="";return _==="bottom"?(A=f?R:`${C}px`,I=`${-b}px`):_==="top"?(A=f?R:`${C}px`,I=`${o.floating.height+b}px`):_==="right"?(A=`${-b}px`,I=f?R:`${E}px`):_==="left"&&(A=`${o.floating.width+b}px`,I=f?R:`${E}px`),{data:{x:A,y:I}}}});function getSideAndAlignFromPlacement(t){const[e,n="center"]=t.split("-");return[e,n]}var Root2$6=Popper,Anchor=PopperAnchor,Content$1=PopperContent,Arrow=PopperArrow,SELECTION_KEYS$1=["Enter"," "],FIRST_KEYS=["ArrowDown","PageUp","Home"],LAST_KEYS=["ArrowUp","PageDown","End"],FIRST_LAST_KEYS=[...FIRST_KEYS,...LAST_KEYS],SUB_OPEN_KEYS={ltr:[...SELECTION_KEYS$1,"ArrowRight"],rtl:[...SELECTION_KEYS$1,"ArrowLeft"]},SUB_CLOSE_KEYS={ltr:["ArrowLeft"],rtl:["ArrowRight"]},MENU_NAME="Menu",[Collection$2,useCollection$2,createCollectionScope$2]=createCollection(MENU_NAME),[createMenuContext,createMenuScope]=createContextScope(MENU_NAME,[createCollectionScope$2,createPopperScope,createRovingFocusGroupScope]),usePopperScope$3=createPopperScope(),useRovingFocusGroupScope$1=createRovingFocusGroupScope(),[MenuProvider,useMenuContext]=createMenuContext(MENU_NAME),[MenuRootProvider,useMenuRootContext]=createMenuContext(MENU_NAME),Menu=t=>{const{__scopeMenu:e,open:n=!1,children:o,dir:l,onOpenChange:d,modal:f=!0}=t,g=usePopperScope$3(e),[b,_]=React__namespace.useState(null),S=React__namespace.useRef(!1),R=useCallbackRef$1(d),C=useDirection(l);return React__namespace.useEffect(()=>{const E=()=>{S.current=!0,document.addEventListener("pointerdown",A,{capture:!0,once:!0}),document.addEventListener("pointermove",A,{capture:!0,once:!0})},A=()=>S.current=!1;return document.addEventListener("keydown",E,{capture:!0}),()=>{document.removeEventListener("keydown",E,{capture:!0}),document.removeEventListener("pointerdown",A,{capture:!0}),document.removeEventListener("pointermove",A,{capture:!0})}},[]),jsxRuntime.jsx(Root2$6,{...g,children:jsxRuntime.jsx(MenuProvider,{scope:e,open:n,onOpenChange:R,content:b,onContentChange:_,children:jsxRuntime.jsx(MenuRootProvider,{scope:e,onClose:React__namespace.useCallback(()=>R(!1),[R]),isUsingKeyboardRef:S,dir:C,modal:f,children:o})})})};Menu.displayName=MENU_NAME;var ANCHOR_NAME$1="MenuAnchor",MenuAnchor=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,...o}=t,l=usePopperScope$3(n);return jsxRuntime.jsx(Anchor,{...l,...o,ref:e})});MenuAnchor.displayName=ANCHOR_NAME$1;var PORTAL_NAME$5="MenuPortal",[PortalProvider$2,usePortalContext$2]=createMenuContext(PORTAL_NAME$5,{forceMount:void 0}),MenuPortal=t=>{const{__scopeMenu:e,forceMount:n,children:o,container:l}=t,d=useMenuContext(PORTAL_NAME$5,e);return jsxRuntime.jsx(PortalProvider$2,{scope:e,forceMount:n,children:jsxRuntime.jsx(Presence,{present:n||d.open,children:jsxRuntime.jsx(Portal$5,{asChild:!0,container:l,children:o})})})};MenuPortal.displayName=PORTAL_NAME$5;var CONTENT_NAME$6="MenuContent",[MenuContentProvider,useMenuContentContext]=createMenuContext(CONTENT_NAME$6),MenuContent=React__namespace.forwardRef((t,e)=>{const n=usePortalContext$2(CONTENT_NAME$6,t.__scopeMenu),{forceMount:o=n.forceMount,...l}=t,d=useMenuContext(CONTENT_NAME$6,t.__scopeMenu),f=useMenuRootContext(CONTENT_NAME$6,t.__scopeMenu);return jsxRuntime.jsx(Collection$2.Provider,{scope:t.__scopeMenu,children:jsxRuntime.jsx(Presence,{present:o||d.open,children:jsxRuntime.jsx(Collection$2.Slot,{scope:t.__scopeMenu,children:f.modal?jsxRuntime.jsx(MenuRootContentModal,{...l,ref:e}):jsxRuntime.jsx(MenuRootContentNonModal,{...l,ref:e})})})})}),MenuRootContentModal=React__namespace.forwardRef((t,e)=>{const n=useMenuContext(CONTENT_NAME$6,t.__scopeMenu),o=React__namespace.useRef(null),l=useComposedRefs(e,o);return React__namespace.useEffect(()=>{const d=o.current;if(d)return hideOthers(d)},[]),jsxRuntime.jsx(MenuContentImpl,{...t,ref:l,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:composeEventHandlers(t.onFocusOutside,d=>d.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),MenuRootContentNonModal=React__namespace.forwardRef((t,e)=>{const n=useMenuContext(CONTENT_NAME$6,t.__scopeMenu);return jsxRuntime.jsx(MenuContentImpl,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Slot$2=createSlot("MenuContent.ScrollLock"),MenuContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,loop:o=!1,trapFocus:l,onOpenAutoFocus:d,onCloseAutoFocus:f,disableOutsidePointerEvents:g,onEntryFocus:b,onEscapeKeyDown:_,onPointerDownOutside:S,onFocusOutside:R,onInteractOutside:C,onDismiss:E,disableOutsideScroll:A,...I}=t,M=useMenuContext(CONTENT_NAME$6,n),j=useMenuRootContext(CONTENT_NAME$6,n),q=usePopperScope$3(n),z=useRovingFocusGroupScope$1(n),Q=useCollection$2(n),[F,O]=React__namespace.useState(null),te=React__namespace.useRef(null),ne=useComposedRefs(e,te,M.onContentChange),ae=React__namespace.useRef(0),ge=React__namespace.useRef(""),oe=React__namespace.useRef(0),je=React__namespace.useRef(null),Ne=React__namespace.useRef("right"),Ae=React__namespace.useRef(0),$e=A?ReactRemoveScroll:React__namespace.Fragment,Fe=A?{as:Slot$2,allowPinchZoom:!0}:void 0,ze=Be=>{var Ze,at;const qe=ge.current+Be,Ke=Q().filter(rt=>!rt.disabled),He=document.activeElement,Xe=(Ze=Ke.find(rt=>rt.ref.current===He))==null?void 0:Ze.textValue,tt=Ke.map(rt=>rt.textValue),Ye=getNextMatch(tt,qe,Xe),et=(at=Ke.find(rt=>rt.textValue===Ye))==null?void 0:at.ref.current;(function rt(it){ge.current=it,window.clearTimeout(ae.current),it!==""&&(ae.current=window.setTimeout(()=>rt(""),1e3))})(qe),et&&setTimeout(()=>et.focus())};React__namespace.useEffect(()=>()=>window.clearTimeout(ae.current),[]),useFocusGuards();const Ve=React__namespace.useCallback(Be=>{var Ke,He;return Ne.current===((Ke=je.current)==null?void 0:Ke.side)&&isPointerInGraceArea(Be,(He=je.current)==null?void 0:He.area)},[]);return jsxRuntime.jsx(MenuContentProvider,{scope:n,searchRef:ge,onItemEnter:React__namespace.useCallback(Be=>{Ve(Be)&&Be.preventDefault()},[Ve]),onItemLeave:React__namespace.useCallback(Be=>{var qe;Ve(Be)||((qe=te.current)==null||qe.focus(),O(null))},[Ve]),onTriggerLeave:React__namespace.useCallback(Be=>{Ve(Be)&&Be.preventDefault()},[Ve]),pointerGraceTimerRef:oe,onPointerGraceIntentChange:React__namespace.useCallback(Be=>{je.current=Be},[]),children:jsxRuntime.jsx($e,{...Fe,children:jsxRuntime.jsx(FocusScope,{asChild:!0,trapped:l,onMountAutoFocus:composeEventHandlers(d,Be=>{var qe;Be.preventDefault(),(qe=te.current)==null||qe.focus({preventScroll:!0})}),onUnmountAutoFocus:f,children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:g,onEscapeKeyDown:_,onPointerDownOutside:S,onFocusOutside:R,onInteractOutside:C,onDismiss:E,children:jsxRuntime.jsx(Root$a,{asChild:!0,...z,dir:j.dir,orientation:"vertical",loop:o,currentTabStopId:F,onCurrentTabStopIdChange:O,onEntryFocus:composeEventHandlers(b,Be=>{j.isUsingKeyboardRef.current||Be.preventDefault()}),preventScrollOnEntryFocus:!0,children:jsxRuntime.jsx(Content$1,{role:"menu","aria-orientation":"vertical","data-state":getOpenState(M.open),"data-radix-menu-content":"",dir:j.dir,...q,...I,ref:ne,style:{outline:"none",...I.style},onKeyDown:composeEventHandlers(I.onKeyDown,Be=>{const Ke=Be.target.closest("[data-radix-menu-content]")===Be.currentTarget,He=Be.ctrlKey||Be.altKey||Be.metaKey,Xe=Be.key.length===1;Ke&&(Be.key==="Tab"&&Be.preventDefault(),!He&&Xe&&ze(Be.key));const tt=te.current;if(Be.target!==tt||!FIRST_LAST_KEYS.includes(Be.key))return;Be.preventDefault();const et=Q().filter(Ze=>!Ze.disabled).map(Ze=>Ze.ref.current);LAST_KEYS.includes(Be.key)&&et.reverse(),focusFirst$1(et)}),onBlur:composeEventHandlers(t.onBlur,Be=>{Be.currentTarget.contains(Be.target)||(window.clearTimeout(ae.current),ge.current="")}),onPointerMove:composeEventHandlers(t.onPointerMove,whenMouse(Be=>{const qe=Be.target,Ke=Ae.current!==Be.clientX;if(Be.currentTarget.contains(qe)&&Ke){const He=Be.clientX>Ae.current?"right":"left";Ne.current=He,Ae.current=Be.clientX}}))})})})})})})});MenuContent.displayName=CONTENT_NAME$6;var GROUP_NAME$2="MenuGroup",MenuGroup=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,...o}=t;return jsxRuntime.jsx(Primitive.div,{role:"group",...o,ref:e})});MenuGroup.displayName=GROUP_NAME$2;var LABEL_NAME$2="MenuLabel",MenuLabel=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,...o}=t;return jsxRuntime.jsx(Primitive.div,{...o,ref:e})});MenuLabel.displayName=LABEL_NAME$2;var ITEM_NAME$2="MenuItem",ITEM_SELECT="menu.itemSelect",MenuItem=React__namespace.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:o,...l}=t,d=React__namespace.useRef(null),f=useMenuRootContext(ITEM_NAME$2,t.__scopeMenu),g=useMenuContentContext(ITEM_NAME$2,t.__scopeMenu),b=useComposedRefs(e,d),_=React__namespace.useRef(!1),S=()=>{const R=d.current;if(!n&&R){const C=new CustomEvent(ITEM_SELECT,{bubbles:!0,cancelable:!0});R.addEventListener(ITEM_SELECT,E=>o==null?void 0:o(E),{once:!0}),dispatchDiscreteCustomEvent(R,C),C.defaultPrevented?_.current=!1:f.onClose()}};return jsxRuntime.jsx(MenuItemImpl,{...l,ref:b,disabled:n,onClick:composeEventHandlers(t.onClick,S),onPointerDown:R=>{var C;(C=t.onPointerDown)==null||C.call(t,R),_.current=!0},onPointerUp:composeEventHandlers(t.onPointerUp,R=>{var C;_.current||(C=R.currentTarget)==null||C.click()}),onKeyDown:composeEventHandlers(t.onKeyDown,R=>{const C=g.searchRef.current!=="";n||C&&R.key===" "||SELECTION_KEYS$1.includes(R.key)&&(R.currentTarget.click(),R.preventDefault())})})});MenuItem.displayName=ITEM_NAME$2;var MenuItemImpl=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:o=!1,textValue:l,...d}=t,f=useMenuContentContext(ITEM_NAME$2,n),g=useRovingFocusGroupScope$1(n),b=React__namespace.useRef(null),_=useComposedRefs(e,b),[S,R]=React__namespace.useState(!1),[C,E]=React__namespace.useState("");return React__namespace.useEffect(()=>{const A=b.current;A&&E((A.textContent??"").trim())},[d.children]),jsxRuntime.jsx(Collection$2.ItemSlot,{scope:n,disabled:o,textValue:l??C,children:jsxRuntime.jsx(Item$2,{asChild:!0,...g,focusable:!o,children:jsxRuntime.jsx(Primitive.div,{role:"menuitem","data-highlighted":S?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...d,ref:_,onPointerMove:composeEventHandlers(t.onPointerMove,whenMouse(A=>{o?f.onItemLeave(A):(f.onItemEnter(A),A.defaultPrevented||A.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:composeEventHandlers(t.onPointerLeave,whenMouse(A=>f.onItemLeave(A))),onFocus:composeEventHandlers(t.onFocus,()=>R(!0)),onBlur:composeEventHandlers(t.onBlur,()=>R(!1))})})})}),CHECKBOX_ITEM_NAME$1="MenuCheckboxItem",MenuCheckboxItem=React__namespace.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:o,...l}=t;return jsxRuntime.jsx(ItemIndicatorProvider,{scope:t.__scopeMenu,checked:n,children:jsxRuntime.jsx(MenuItem,{role:"menuitemcheckbox","aria-checked":isIndeterminate$1(n)?"mixed":n,...l,ref:e,"data-state":getCheckedState(n),onSelect:composeEventHandlers(l.onSelect,()=>o==null?void 0:o(isIndeterminate$1(n)?!0:!n),{checkForDefaultPrevented:!1})})})});MenuCheckboxItem.displayName=CHECKBOX_ITEM_NAME$1;var RADIO_GROUP_NAME$1="MenuRadioGroup",[RadioGroupProvider,useRadioGroupContext]=createMenuContext(RADIO_GROUP_NAME$1,{value:void 0,onValueChange:()=>{}}),MenuRadioGroup=React__namespace.forwardRef((t,e)=>{const{value:n,onValueChange:o,...l}=t,d=useCallbackRef$1(o);return jsxRuntime.jsx(RadioGroupProvider,{scope:t.__scopeMenu,value:n,onValueChange:d,children:jsxRuntime.jsx(MenuGroup,{...l,ref:e})})});MenuRadioGroup.displayName=RADIO_GROUP_NAME$1;var RADIO_ITEM_NAME$1="MenuRadioItem",MenuRadioItem=React__namespace.forwardRef((t,e)=>{const{value:n,...o}=t,l=useRadioGroupContext(RADIO_ITEM_NAME$1,t.__scopeMenu),d=n===l.value;return jsxRuntime.jsx(ItemIndicatorProvider,{scope:t.__scopeMenu,checked:d,children:jsxRuntime.jsx(MenuItem,{role:"menuitemradio","aria-checked":d,...o,ref:e,"data-state":getCheckedState(d),onSelect:composeEventHandlers(o.onSelect,()=>{var f;return(f=l.onValueChange)==null?void 0:f.call(l,n)},{checkForDefaultPrevented:!1})})})});MenuRadioItem.displayName=RADIO_ITEM_NAME$1;var ITEM_INDICATOR_NAME$1="MenuItemIndicator",[ItemIndicatorProvider,useItemIndicatorContext]=createMenuContext(ITEM_INDICATOR_NAME$1,{checked:!1}),MenuItemIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:o,...l}=t,d=useItemIndicatorContext(ITEM_INDICATOR_NAME$1,n);return jsxRuntime.jsx(Presence,{present:o||isIndeterminate$1(d.checked)||d.checked===!0,children:jsxRuntime.jsx(Primitive.span,{...l,ref:e,"data-state":getCheckedState(d.checked)})})});MenuItemIndicator.displayName=ITEM_INDICATOR_NAME$1;var SEPARATOR_NAME$2="MenuSeparator",MenuSeparator=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,...o}=t;return jsxRuntime.jsx(Primitive.div,{role:"separator","aria-orientation":"horizontal",...o,ref:e})});MenuSeparator.displayName=SEPARATOR_NAME$2;var ARROW_NAME$4="MenuArrow",MenuArrow=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,...o}=t,l=usePopperScope$3(n);return jsxRuntime.jsx(Arrow,{...l,...o,ref:e})});MenuArrow.displayName=ARROW_NAME$4;var SUB_NAME="MenuSub",[MenuSubProvider,useMenuSubContext]=createMenuContext(SUB_NAME),MenuSub=t=>{const{__scopeMenu:e,children:n,open:o=!1,onOpenChange:l}=t,d=useMenuContext(SUB_NAME,e),f=usePopperScope$3(e),[g,b]=React__namespace.useState(null),[_,S]=React__namespace.useState(null),R=useCallbackRef$1(l);return React__namespace.useEffect(()=>(d.open===!1&&R(!1),()=>R(!1)),[d.open,R]),jsxRuntime.jsx(Root2$6,{...f,children:jsxRuntime.jsx(MenuProvider,{scope:e,open:o,onOpenChange:R,content:_,onContentChange:S,children:jsxRuntime.jsx(MenuSubProvider,{scope:e,contentId:useId(),triggerId:useId(),trigger:g,onTriggerChange:b,children:n})})})};MenuSub.displayName=SUB_NAME;var SUB_TRIGGER_NAME$1="MenuSubTrigger",MenuSubTrigger=React__namespace.forwardRef((t,e)=>{const n=useMenuContext(SUB_TRIGGER_NAME$1,t.__scopeMenu),o=useMenuRootContext(SUB_TRIGGER_NAME$1,t.__scopeMenu),l=useMenuSubContext(SUB_TRIGGER_NAME$1,t.__scopeMenu),d=useMenuContentContext(SUB_TRIGGER_NAME$1,t.__scopeMenu),f=React__namespace.useRef(null),{pointerGraceTimerRef:g,onPointerGraceIntentChange:b}=d,_={__scopeMenu:t.__scopeMenu},S=React__namespace.useCallback(()=>{f.current&&window.clearTimeout(f.current),f.current=null},[]);return React__namespace.useEffect(()=>S,[S]),React__namespace.useEffect(()=>{const R=g.current;return()=>{window.clearTimeout(R),b(null)}},[g,b]),jsxRuntime.jsx(MenuAnchor,{asChild:!0,..._,children:jsxRuntime.jsx(MenuItemImpl,{id:l.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":l.contentId,"data-state":getOpenState(n.open),...t,ref:composeRefs(e,l.onTriggerChange),onClick:R=>{var C;(C=t.onClick)==null||C.call(t,R),!(t.disabled||R.defaultPrevented)&&(R.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:composeEventHandlers(t.onPointerMove,whenMouse(R=>{d.onItemEnter(R),!R.defaultPrevented&&!t.disabled&&!n.open&&!f.current&&(d.onPointerGraceIntentChange(null),f.current=window.setTimeout(()=>{n.onOpenChange(!0),S()},100))})),onPointerLeave:composeEventHandlers(t.onPointerLeave,whenMouse(R=>{var E,A;S();const C=(E=n.content)==null?void 0:E.getBoundingClientRect();if(C){const I=(A=n.content)==null?void 0:A.dataset.side,M=I==="right",j=M?-5:5,q=C[M?"left":"right"],z=C[M?"right":"left"];d.onPointerGraceIntentChange({area:[{x:R.clientX+j,y:R.clientY},{x:q,y:C.top},{x:z,y:C.top},{x:z,y:C.bottom},{x:q,y:C.bottom}],side:I}),window.clearTimeout(g.current),g.current=window.setTimeout(()=>d.onPointerGraceIntentChange(null),300)}else{if(d.onTriggerLeave(R),R.defaultPrevented)return;d.onPointerGraceIntentChange(null)}})),onKeyDown:composeEventHandlers(t.onKeyDown,R=>{var E;const C=d.searchRef.current!=="";t.disabled||C&&R.key===" "||SUB_OPEN_KEYS[o.dir].includes(R.key)&&(n.onOpenChange(!0),(E=n.content)==null||E.focus(),R.preventDefault())})})})});MenuSubTrigger.displayName=SUB_TRIGGER_NAME$1;var SUB_CONTENT_NAME$1="MenuSubContent",MenuSubContent=React__namespace.forwardRef((t,e)=>{const n=usePortalContext$2(CONTENT_NAME$6,t.__scopeMenu),{forceMount:o=n.forceMount,...l}=t,d=useMenuContext(CONTENT_NAME$6,t.__scopeMenu),f=useMenuRootContext(CONTENT_NAME$6,t.__scopeMenu),g=useMenuSubContext(SUB_CONTENT_NAME$1,t.__scopeMenu),b=React__namespace.useRef(null),_=useComposedRefs(e,b);return jsxRuntime.jsx(Collection$2.Provider,{scope:t.__scopeMenu,children:jsxRuntime.jsx(Presence,{present:o||d.open,children:jsxRuntime.jsx(Collection$2.Slot,{scope:t.__scopeMenu,children:jsxRuntime.jsx(MenuContentImpl,{id:g.contentId,"aria-labelledby":g.triggerId,...l,ref:_,align:"start",side:f.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:S=>{var R;f.isUsingKeyboardRef.current&&((R=b.current)==null||R.focus()),S.preventDefault()},onCloseAutoFocus:S=>S.preventDefault(),onFocusOutside:composeEventHandlers(t.onFocusOutside,S=>{S.target!==g.trigger&&d.onOpenChange(!1)}),onEscapeKeyDown:composeEventHandlers(t.onEscapeKeyDown,S=>{f.onClose(),S.preventDefault()}),onKeyDown:composeEventHandlers(t.onKeyDown,S=>{var E;const R=S.currentTarget.contains(S.target),C=SUB_CLOSE_KEYS[f.dir].includes(S.key);R&&C&&(d.onOpenChange(!1),(E=g.trigger)==null||E.focus(),S.preventDefault())})})})})})});MenuSubContent.displayName=SUB_CONTENT_NAME$1;function getOpenState(t){return t?"open":"closed"}function isIndeterminate$1(t){return t==="indeterminate"}function getCheckedState(t){return isIndeterminate$1(t)?"indeterminate":t?"checked":"unchecked"}function focusFirst$1(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function wrapArray$1(t,e){return t.map((n,o)=>t[(e+o)%t.length])}function getNextMatch(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$1(t,Math.max(d,0));l.length===1&&(f=f.filter(_=>_!==n));const b=f.find(_=>_.toLowerCase().startsWith(l.toLowerCase()));return b!==n?b:void 0}function isPointInPolygon$1(t,e){const{x:n,y:o}=t;let l=!1;for(let d=0,f=e.length-1;d<e.length;f=d++){const g=e[d],b=e[f],_=g.x,S=g.y,R=b.x,C=b.y;S>o!=C>o&&n<(R-_)*(o-S)/(C-S)+_&&(l=!l)}return l}function isPointerInGraceArea(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return isPointInPolygon$1(n,e)}function whenMouse(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Root3$1=Menu,Anchor2$1=MenuAnchor,Portal$3=MenuPortal,Content2$5=MenuContent,Group$1=MenuGroup,Label$4=MenuLabel,Item2$1=MenuItem,CheckboxItem=MenuCheckboxItem,RadioGroup=MenuRadioGroup,RadioItem=MenuRadioItem,ItemIndicator$1=MenuItemIndicator,Separator$3=MenuSeparator,Arrow2=MenuArrow,Sub=MenuSub,SubTrigger=MenuSubTrigger,SubContent=MenuSubContent,DROPDOWN_MENU_NAME="DropdownMenu",[createDropdownMenuContext,createDropdownMenuScope]=createContextScope(DROPDOWN_MENU_NAME,[createMenuScope]),useMenuScope=createMenuScope(),[DropdownMenuProvider,useDropdownMenuContext]=createDropdownMenuContext(DROPDOWN_MENU_NAME),DropdownMenu$1=t=>{const{__scopeDropdownMenu:e,children:n,dir:o,open:l,defaultOpen:d,onOpenChange:f,modal:g=!0}=t,b=useMenuScope(e),_=React__namespace.useRef(null),[S,R]=useControllableState({prop:l,defaultProp:d??!1,onChange:f,caller:DROPDOWN_MENU_NAME});return jsxRuntime.jsx(DropdownMenuProvider,{scope:e,triggerId:useId(),triggerRef:_,contentId:useId(),open:S,onOpenChange:R,onOpenToggle:React__namespace.useCallback(()=>R(C=>!C),[R]),modal:g,children:jsxRuntime.jsx(Root3$1,{...b,open:S,onOpenChange:R,dir:o,modal:g,children:n})})};DropdownMenu$1.displayName=DROPDOWN_MENU_NAME;var TRIGGER_NAME$6="DropdownMenuTrigger",DropdownMenuTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:o=!1,...l}=t,d=useDropdownMenuContext(TRIGGER_NAME$6,n),f=useMenuScope(n);return jsxRuntime.jsx(Anchor2$1,{asChild:!0,...f,children:jsxRuntime.jsx(Primitive.button,{type:"button",id:d.triggerId,"aria-haspopup":"menu","aria-expanded":d.open,"aria-controls":d.open?d.contentId:void 0,"data-state":d.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...l,ref:composeRefs(e,d.triggerRef),onPointerDown:composeEventHandlers(t.onPointerDown,g=>{!o&&g.button===0&&g.ctrlKey===!1&&(d.onOpenToggle(),d.open||g.preventDefault())}),onKeyDown:composeEventHandlers(t.onKeyDown,g=>{o||(["Enter"," "].includes(g.key)&&d.onOpenToggle(),g.key==="ArrowDown"&&d.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(g.key)&&g.preventDefault())})})})});DropdownMenuTrigger$1.displayName=TRIGGER_NAME$6;var PORTAL_NAME$4="DropdownMenuPortal",DropdownMenuPortal$1=t=>{const{__scopeDropdownMenu:e,...n}=t,o=useMenuScope(e);return jsxRuntime.jsx(Portal$3,{...o,...n})};DropdownMenuPortal$1.displayName=PORTAL_NAME$4;var CONTENT_NAME$5="DropdownMenuContent",DropdownMenuContent$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useDropdownMenuContext(CONTENT_NAME$5,n),d=useMenuScope(n),f=React__namespace.useRef(!1);return jsxRuntime.jsx(Content2$5,{id:l.contentId,"aria-labelledby":l.triggerId,...d,...o,ref:e,onCloseAutoFocus:composeEventHandlers(t.onCloseAutoFocus,g=>{var b;f.current||(b=l.triggerRef.current)==null||b.focus(),f.current=!1,g.preventDefault()}),onInteractOutside:composeEventHandlers(t.onInteractOutside,g=>{const b=g.detail.originalEvent,_=b.button===0&&b.ctrlKey===!0,S=b.button===2||_;(!l.modal||S)&&(f.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});DropdownMenuContent$1.displayName=CONTENT_NAME$5;var GROUP_NAME$1="DropdownMenuGroup",DropdownMenuGroup$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(Group$1,{...l,...o,ref:e})});DropdownMenuGroup$1.displayName=GROUP_NAME$1;var LABEL_NAME$1="DropdownMenuLabel",DropdownMenuLabel$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(Label$4,{...l,...o,ref:e})});DropdownMenuLabel$1.displayName=LABEL_NAME$1;var ITEM_NAME$1="DropdownMenuItem",DropdownMenuItem$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(Item2$1,{...l,...o,ref:e})});DropdownMenuItem$1.displayName=ITEM_NAME$1;var CHECKBOX_ITEM_NAME="DropdownMenuCheckboxItem",DropdownMenuCheckboxItem$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(CheckboxItem,{...l,...o,ref:e})});DropdownMenuCheckboxItem$1.displayName=CHECKBOX_ITEM_NAME;var RADIO_GROUP_NAME="DropdownMenuRadioGroup",DropdownMenuRadioGroup$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(RadioGroup,{...l,...o,ref:e})});DropdownMenuRadioGroup$1.displayName=RADIO_GROUP_NAME;var RADIO_ITEM_NAME="DropdownMenuRadioItem",DropdownMenuRadioItem$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(RadioItem,{...l,...o,ref:e})});DropdownMenuRadioItem$1.displayName=RADIO_ITEM_NAME;var INDICATOR_NAME$2="DropdownMenuItemIndicator",DropdownMenuItemIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(ItemIndicator$1,{...l,...o,ref:e})});DropdownMenuItemIndicator.displayName=INDICATOR_NAME$2;var SEPARATOR_NAME$1="DropdownMenuSeparator",DropdownMenuSeparator$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(Separator$3,{...l,...o,ref:e})});DropdownMenuSeparator$1.displayName=SEPARATOR_NAME$1;var ARROW_NAME$3="DropdownMenuArrow",DropdownMenuArrow=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(Arrow2,{...l,...o,ref:e})});DropdownMenuArrow.displayName=ARROW_NAME$3;var DropdownMenuSub$1=t=>{const{__scopeDropdownMenu:e,children:n,open:o,onOpenChange:l,defaultOpen:d}=t,f=useMenuScope(e),[g,b]=useControllableState({prop:o,defaultProp:d??!1,onChange:l,caller:"DropdownMenuSub"});return jsxRuntime.jsx(Sub,{...f,open:g,onOpenChange:b,children:n})},SUB_TRIGGER_NAME="DropdownMenuSubTrigger",DropdownMenuSubTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(SubTrigger,{...l,...o,ref:e})});DropdownMenuSubTrigger$1.displayName=SUB_TRIGGER_NAME;var SUB_CONTENT_NAME="DropdownMenuSubContent",DropdownMenuSubContent$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(SubContent,{...l,...o,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});DropdownMenuSubContent$1.displayName=SUB_CONTENT_NAME;var Root2$5=DropdownMenu$1,Trigger$4=DropdownMenuTrigger$1,Portal2$1=DropdownMenuPortal$1,Content2$4=DropdownMenuContent$1,Group2=DropdownMenuGroup$1,Label2=DropdownMenuLabel$1,Item2=DropdownMenuItem$1,CheckboxItem2=DropdownMenuCheckboxItem$1,RadioGroup2=DropdownMenuRadioGroup$1,RadioItem2=DropdownMenuRadioItem$1,ItemIndicator2=DropdownMenuItemIndicator,Separator2=DropdownMenuSeparator$1,Sub2=DropdownMenuSub$1,SubTrigger2=DropdownMenuSubTrigger$1,SubContent2=DropdownMenuSubContent$1;const DropdownMenu=Root2$5,DropdownMenuTrigger=Trigger$4,DropdownMenuGroup=Group2,DropdownMenuPortal=Portal2$1,DropdownMenuSub=Sub2,DropdownMenuRadioGroup=RadioGroup2,DropdownMenuSubTrigger=React__namespace.forwardRef(({className:t,inset:e,children:n,...o},l)=>jsxRuntime.jsxs(SubTrigger2,{ref:l,className:cn("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e&&"pl-8",t),...o,children:[n,jsxRuntime.jsx(ChevronRight,{className:"ml-auto"})]}));DropdownMenuSubTrigger.displayName=SubTrigger2.displayName;const DropdownMenuSubContent=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(SubContent2,{ref:n,className:cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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-dropdown-menu-content-transform-origin]",t),...e}));DropdownMenuSubContent.displayName=SubContent2.displayName;const DropdownMenuContent=React__namespace.forwardRef(({className:t,sideOffset:e=4,...n},o)=>jsxRuntime.jsx(Portal2$1,{children:jsxRuntime.jsx(Content2$4,{ref:o,sideOffset:e,className:cn("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 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-dropdown-menu-content-transform-origin]",t),...n})}));DropdownMenuContent.displayName=Content2$4.displayName;const DropdownMenuItem=React__namespace.forwardRef(({className:t,inset:e,...n},o)=>jsxRuntime.jsx(Item2,{ref:o,className:cn("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",e&&"pl-8",t),...n}));DropdownMenuItem.displayName=Item2.displayName;const DropdownMenuCheckboxItem=React__namespace.forwardRef(({className:t,children:e,checked:n,...o},l)=>jsxRuntime.jsxs(CheckboxItem2,{ref:l,className:cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...o,children:[jsxRuntime.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(ItemIndicator2,{children:jsxRuntime.jsx(Check,{className:"h-4 w-4"})})}),e]}));DropdownMenuCheckboxItem.displayName=CheckboxItem2.displayName;const DropdownMenuRadioItem=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsxs(RadioItem2,{ref:o,className:cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[jsxRuntime.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(ItemIndicator2,{children:jsxRuntime.jsx(Circle,{className:"h-2 w-2 fill-current"})})}),e]}));DropdownMenuRadioItem.displayName=RadioItem2.displayName;const DropdownMenuLabel=React__namespace.forwardRef(({className:t,inset:e,...n},o)=>jsxRuntime.jsx(Label2,{ref:o,className:cn("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));DropdownMenuLabel.displayName=Label2.displayName;const DropdownMenuSeparator=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Separator2,{ref:n,className:cn("-mx-1 my-1 h-px bg-muted",t),...e}));DropdownMenuSeparator.displayName=Separator2.displayName;const DropdownMenuShortcut=({className:t,...e})=>jsxRuntime.jsx("span",{className:cn("ml-auto text-xs tracking-widest opacity-60",t),...e});DropdownMenuShortcut.displayName="DropdownMenuShortcut";function ProductInventoryGrid({inventory:t,showBinLocation:e}){const n=(j,q,z=!1,Q=!0)=>jsxRuntime.jsxs("div",{className:`p-3 text-sm ${Q&&q>0?"border-t":""} ${z?"border-r":""}`,children:[jsxRuntime.jsxs("div",{className:"flex justify-between font-medium",children:[jsxRuntime.jsx("span",{children:j.Name}),jsxRuntime.jsx("span",{children:formatNumber(j.AvailableQuantity??0)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-1 text-xs text-gray-600",children:[jsxRuntime.jsx("span",{children:"Expecting"}),jsxRuntime.jsx("span",{children:j.PurchaseOrderQuantity?formatNumber(j.PurchaseOrderQuantity):"—"})]}),e&&jsxRuntime.jsxs("div",{className:"flex justify-between mt-1 text-xs text-gray-600",children:[jsxRuntime.jsx("span",{children:"Bin Location"}),jsxRuntime.jsx("span",{children:j.BinLocation||"—"})]})]},`warehouse-${j.WarehouseId}`),o=["MTL","TOR"],l=["VAN","EDM"],d=[...t].sort((j,q)=>(j.Name||"").localeCompare(q.Name||"")),f=d.filter(j=>j.Country==="US"),g=d.filter(j=>j.Country==="CA"),b=d.filter(j=>l.includes(j.WarehouseId||"")),_=d.filter(j=>o.includes(j.WarehouseId||"")),S=g.filter(j=>!o.includes(j.WarehouseId||"")&&!l.includes(j.WarehouseId||"")),R=j=>j.reduce((q,z)=>q+(z.AvailableQuantity||0),0),C=R(g),E=R(_),A=R(b),I=R(f),M=C+I;return jsxRuntime.jsxs("div",{className:"border rounded-md overflow-hidden",children:[g.length>0&&f.length>0&&jsxRuntime.jsxs("div",{className:"grid grid-cols-2 border-b",children:[jsxRuntime.jsxs("div",{className:"p-3 font-semibold text-sm flex justify-between",children:[jsxRuntime.jsx("span",{children:"Total"}),jsxRuntime.jsx("span",{children:M})]}),jsxRuntime.jsx("div",{className:"p-3"})]}),g.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 border-b bg-gray-50",children:[jsxRuntime.jsxs("div",{className:"p-3 font-semibold text-sm flex justify-between",children:[jsxRuntime.jsx("span",{children:"Canada"}),jsxRuntime.jsx("span",{children:formatNumber(C)})]}),jsxRuntime.jsx("div",{className:"p-3"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2",children:[jsxRuntime.jsxs("div",{className:"border-r",children:[jsxRuntime.jsxs("div",{className:"p-3 font-semibold text-sm flex justify-between",children:[jsxRuntime.jsx("span",{children:"West"}),jsxRuntime.jsx("span",{children:formatNumber(A)})]}),b.map((j,q)=>n(j,q))]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"p-3 font-semibold text-sm flex justify-between",children:[jsxRuntime.jsx("span",{children:"East"}),jsxRuntime.jsx("span",{children:formatNumber(E)})]}),_.map((j,q)=>n(j,q))]})]}),S.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"border-t p-3 font-semibold text-sm",children:jsxRuntime.jsx("span",{children:"Other"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-2",children:S.map((j,q)=>n(j,q,q%2===0,!0))})]})]}),f.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 border-t bg-gray-50",children:[jsxRuntime.jsxs("div",{className:"p-3 font-semibold text-sm flex justify-between",children:[jsxRuntime.jsx("span",{children:"United States"}),jsxRuntime.jsx("span",{children:formatNumber(I)})]}),jsxRuntime.jsx("div",{className:"p-3"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-2",children:f.map((j,q)=>n(j,q,q%2===0,!0))})]}),t.length===0&&jsxRuntime.jsx("div",{className:"p-6 text-center text-gray-500",children:"No inventory information available"})]})}const falsyToString=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,cx=clsx,cva=(t,e)=>n=>{var o;if((e==null?void 0:e.variants)==null)return cx(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:l,defaultVariants:d}=e,f=Object.keys(l).map(_=>{const S=n==null?void 0:n[_],R=d==null?void 0:d[_];if(S===null)return null;const C=falsyToString(S)||falsyToString(R);return l[_][C]}),g=n&&Object.entries(n).reduce((_,S)=>{let[R,C]=S;return C===void 0||(_[R]=C),_},{}),b=e==null||(o=e.compoundVariants)===null||o===void 0?void 0:o.reduce((_,S)=>{let{class:R,className:C,...E}=S;return Object.entries(E).every(A=>{let[I,M]=A;return Array.isArray(M)?M.includes({...d,...g}[I]):{...d,...g}[I]===M})?[..._,R,C]:_},[]);return cx(t,f,b,n==null?void 0:n.class,n==null?void 0:n.className)},buttonVariants=cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 cursor-pointer",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90",outline:"border border-input text-foreground bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",defaultOutline:"border border-red-600/30 text-red-600 bg-background shadow-xs hover:bg-red-600/5 ",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",blue:"bg-randmar-blue text-gray-100 shadow-sm hover:bg-randmar-blue/90",red:"bg-randmar-red text-gray-100 shadow-sm hover:bg-randmar-red/90",purple:"bg-randmar-purple text-gray-100 shadow-sm hover:bg-randmar-purple/90",none:""},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Button=React__namespace.forwardRef(({className:t,variant:e,size:n,asChild:o=!1,confirmationDialog:l,onClick:d,...f},g)=>{const b=o?Slot$4:"button";if(!l)return jsxRuntime.jsx(b,{className:cn(buttonVariants({variant:e,size:n,className:t})),ref:g,onClick:d,...f});d&&console.warn("Button: You provided both onClick and confirmationDialog props. The onClick prop will be ignored. Use the onConfirm callback in confirmationDialog instead.");const{title:_,content:S,onConfirm:R,confirmText:C="Confirm",cancelText:E="Cancel"}=l,A=()=>{R()};return jsxRuntime.jsxs(Dialog,{children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsx(b,{className:cn(buttonVariants({variant:e,size:n,className:t})),ref:g,...f})}),jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:_}),jsxRuntime.jsx(DialogDescription,{children:S})]}),jsxRuntime.jsxs(DialogFooter,{className:"flex justify-end gap-2 pt-4",children:[jsxRuntime.jsx(DialogClose,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"outline",children:E})}),jsxRuntime.jsx(DialogClose,{asChild:!0,children:jsxRuntime.jsx(Button,{onClick:A,children:C})})]})]})]})});Button.displayName="Button";var VISUALLY_HIDDEN_STYLES=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),NAME$2="VisuallyHidden",VisuallyHidden=React__namespace.forwardRef((t,e)=>jsxRuntime.jsx(Primitive.span,{...t,ref:e,style:{...VISUALLY_HIDDEN_STYLES,...t.style}}));VisuallyHidden.displayName=NAME$2;var Root$6=VisuallyHidden,[createTooltipContext,createTooltipScope]=createContextScope("Tooltip",[createPopperScope]),usePopperScope$2=createPopperScope(),PROVIDER_NAME$1="TooltipProvider",DEFAULT_DELAY_DURATION=700,TOOLTIP_OPEN="tooltip.open",[TooltipProviderContextProvider,useTooltipProviderContext]=createTooltipContext(PROVIDER_NAME$1),TooltipProvider$1=t=>{const{__scopeTooltip:e,delayDuration:n=DEFAULT_DELAY_DURATION,skipDelayDuration:o=300,disableHoverableContent:l=!1,children:d}=t,f=React__namespace.useRef(!0),g=React__namespace.useRef(!1),b=React__namespace.useRef(0);return React__namespace.useEffect(()=>{const _=b.current;return()=>window.clearTimeout(_)},[]),jsxRuntime.jsx(TooltipProviderContextProvider,{scope:e,isOpenDelayedRef:f,delayDuration:n,onOpen:React__namespace.useCallback(()=>{window.clearTimeout(b.current),f.current=!1},[]),onClose:React__namespace.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>f.current=!0,o)},[o]),isPointerInTransitRef:g,onPointerInTransitChange:React__namespace.useCallback(_=>{g.current=_},[]),disableHoverableContent:l,children:d})};TooltipProvider$1.displayName=PROVIDER_NAME$1;var TOOLTIP_NAME="Tooltip",[TooltipContextProvider,useTooltipContext]=createTooltipContext(TOOLTIP_NAME),Tooltip$2=t=>{const{__scopeTooltip:e,children:n,open:o,defaultOpen:l,onOpenChange:d,disableHoverableContent:f,delayDuration:g}=t,b=useTooltipProviderContext(TOOLTIP_NAME,t.__scopeTooltip),_=usePopperScope$2(e),[S,R]=React__namespace.useState(null),C=useId(),E=React__namespace.useRef(0),A=f??b.disableHoverableContent,I=g??b.delayDuration,M=React__namespace.useRef(!1),[j,q]=useControllableState({prop:o,defaultProp:l??!1,onChange:te=>{te?(b.onOpen(),document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN))):b.onClose(),d==null||d(te)},caller:TOOLTIP_NAME}),z=React__namespace.useMemo(()=>j?M.current?"delayed-open":"instant-open":"closed",[j]),Q=React__namespace.useCallback(()=>{window.clearTimeout(E.current),E.current=0,M.current=!1,q(!0)},[q]),F=React__namespace.useCallback(()=>{window.clearTimeout(E.current),E.current=0,q(!1)},[q]),O=React__namespace.useCallback(()=>{window.clearTimeout(E.current),E.current=window.setTimeout(()=>{M.current=!0,q(!0),E.current=0},I)},[I,q]);return React__namespace.useEffect(()=>()=>{E.current&&(window.clearTimeout(E.current),E.current=0)},[]),jsxRuntime.jsx(Root2$6,{..._,children:jsxRuntime.jsx(TooltipContextProvider,{scope:e,contentId:C,open:j,stateAttribute:z,trigger:S,onTriggerChange:R,onTriggerEnter:React__namespace.useCallback(()=>{b.isOpenDelayedRef.current?O():Q()},[b.isOpenDelayedRef,O,Q]),onTriggerLeave:React__namespace.useCallback(()=>{A?F():(window.clearTimeout(E.current),E.current=0)},[F,A]),onOpen:Q,onClose:F,disableHoverableContent:A,children:n})})};Tooltip$2.displayName=TOOLTIP_NAME;var TRIGGER_NAME$5="TooltipTrigger",TooltipTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeTooltip:n,...o}=t,l=useTooltipContext(TRIGGER_NAME$5,n),d=useTooltipProviderContext(TRIGGER_NAME$5,n),f=usePopperScope$2(n),g=React__namespace.useRef(null),b=useComposedRefs(e,g,l.onTriggerChange),_=React__namespace.useRef(!1),S=React__namespace.useRef(!1),R=React__namespace.useCallback(()=>_.current=!1,[]);return React__namespace.useEffect(()=>()=>document.removeEventListener("pointerup",R),[R]),jsxRuntime.jsx(Anchor,{asChild:!0,...f,children:jsxRuntime.jsx(Primitive.button,{"aria-describedby":l.open?l.contentId:void 0,"data-state":l.stateAttribute,...o,ref:b,onPointerMove:composeEventHandlers(t.onPointerMove,C=>{C.pointerType!=="touch"&&!S.current&&!d.isPointerInTransitRef.current&&(l.onTriggerEnter(),S.current=!0)}),onPointerLeave:composeEventHandlers(t.onPointerLeave,()=>{l.onTriggerLeave(),S.current=!1}),onPointerDown:composeEventHandlers(t.onPointerDown,()=>{l.open&&l.onClose(),_.current=!0,document.addEventListener("pointerup",R,{once:!0})}),onFocus:composeEventHandlers(t.onFocus,()=>{_.current||l.onOpen()}),onBlur:composeEventHandlers(t.onBlur,l.onClose),onClick:composeEventHandlers(t.onClick,l.onClose)})})});TooltipTrigger$1.displayName=TRIGGER_NAME$5;var PORTAL_NAME$3="TooltipPortal",[PortalProvider$1,usePortalContext$1]=createTooltipContext(PORTAL_NAME$3,{forceMount:void 0}),TooltipPortal=t=>{const{__scopeTooltip:e,forceMount:n,children:o,container:l}=t,d=useTooltipContext(PORTAL_NAME$3,e);return jsxRuntime.jsx(PortalProvider$1,{scope:e,forceMount:n,children:jsxRuntime.jsx(Presence,{present:n||d.open,children:jsxRuntime.jsx(Portal$5,{asChild:!0,container:l,children:o})})})};TooltipPortal.displayName=PORTAL_NAME$3;var CONTENT_NAME$4="TooltipContent",TooltipContent$1=React__namespace.forwardRef((t,e)=>{const n=usePortalContext$1(CONTENT_NAME$4,t.__scopeTooltip),{forceMount:o=n.forceMount,side:l="top",...d}=t,f=useTooltipContext(CONTENT_NAME$4,t.__scopeTooltip);return jsxRuntime.jsx(Presence,{present:o||f.open,children:f.disableHoverableContent?jsxRuntime.jsx(TooltipContentImpl,{side:l,...d,ref:e}):jsxRuntime.jsx(TooltipContentHoverable,{side:l,...d,ref:e})})}),TooltipContentHoverable=React__namespace.forwardRef((t,e)=>{const n=useTooltipContext(CONTENT_NAME$4,t.__scopeTooltip),o=useTooltipProviderContext(CONTENT_NAME$4,t.__scopeTooltip),l=React__namespace.useRef(null),d=useComposedRefs(e,l),[f,g]=React__namespace.useState(null),{trigger:b,onClose:_}=n,S=l.current,{onPointerInTransitChange:R}=o,C=React__namespace.useCallback(()=>{g(null),R(!1)},[R]),E=React__namespace.useCallback((A,I)=>{const M=A.currentTarget,j={x:A.clientX,y:A.clientY},q=getExitSideFromRect(j,M.getBoundingClientRect()),z=getPaddedExitPoints(j,q),Q=getPointsFromRect(I.getBoundingClientRect()),F=getHull([...z,...Q]);g(F),R(!0)},[R]);return React__namespace.useEffect(()=>()=>C(),[C]),React__namespace.useEffect(()=>{if(b&&S){const A=M=>E(M,S),I=M=>E(M,b);return b.addEventListener("pointerleave",A),S.addEventListener("pointerleave",I),()=>{b.removeEventListener("pointerleave",A),S.removeEventListener("pointerleave",I)}}},[b,S,E,C]),React__namespace.useEffect(()=>{if(f){const A=I=>{const M=I.target,j={x:I.clientX,y:I.clientY},q=(b==null?void 0:b.contains(M))||(S==null?void 0:S.contains(M)),z=!isPointInPolygon(j,f);q?C():z&&(C(),_())};return document.addEventListener("pointermove",A),()=>document.removeEventListener("pointermove",A)}},[b,S,f,_,C]),jsxRuntime.jsx(TooltipContentImpl,{...t,ref:d})}),[VisuallyHiddenContentContextProvider,useVisuallyHiddenContentContext]=createTooltipContext(TOOLTIP_NAME,{isInside:!1}),Slottable$1=createSlottable("TooltipContent"),TooltipContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopeTooltip:n,children:o,"aria-label":l,onEscapeKeyDown:d,onPointerDownOutside:f,...g}=t,b=useTooltipContext(CONTENT_NAME$4,n),_=usePopperScope$2(n),{onClose:S}=b;return React__namespace.useEffect(()=>(document.addEventListener(TOOLTIP_OPEN,S),()=>document.removeEventListener(TOOLTIP_OPEN,S)),[S]),React__namespace.useEffect(()=>{if(b.trigger){const R=C=>{const E=C.target;E!=null&&E.contains(b.trigger)&&S()};return window.addEventListener("scroll",R,{capture:!0}),()=>window.removeEventListener("scroll",R,{capture:!0})}},[b.trigger,S]),jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:R=>R.preventDefault(),onDismiss:S,children:jsxRuntime.jsxs(Content$1,{"data-state":b.stateAttribute,..._,...g,ref:e,style:{...g.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[jsxRuntime.jsx(Slottable$1,{children:o}),jsxRuntime.jsx(VisuallyHiddenContentContextProvider,{scope:n,isInside:!0,children:jsxRuntime.jsx(Root$6,{id:b.contentId,role:"tooltip",children:l||o})})]})})});TooltipContent$1.displayName=CONTENT_NAME$4;var ARROW_NAME$2="TooltipArrow",TooltipArrow=React__namespace.forwardRef((t,e)=>{const{__scopeTooltip:n,...o}=t,l=usePopperScope$2(n);return useVisuallyHiddenContentContext(ARROW_NAME$2,n).isInside?null:jsxRuntime.jsx(Arrow,{...l,...o,ref:e})});TooltipArrow.displayName=ARROW_NAME$2;function getExitSideFromRect(t,e){const n=Math.abs(e.top-t.y),o=Math.abs(e.bottom-t.y),l=Math.abs(e.right-t.x),d=Math.abs(e.left-t.x);switch(Math.min(n,o,l,d)){case d:return"left";case l:return"right";case n:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function getPaddedExitPoints(t,e,n=5){const o=[];switch(e){case"top":o.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":o.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":o.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":o.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return o}function getPointsFromRect(t){const{top:e,right:n,bottom:o,left:l}=t;return[{x:l,y:e},{x:n,y:e},{x:n,y:o},{x:l,y:o}]}function isPointInPolygon(t,e){const{x:n,y:o}=t;let l=!1;for(let d=0,f=e.length-1;d<e.length;f=d++){const g=e[d],b=e[f],_=g.x,S=g.y,R=b.x,C=b.y;S>o!=C>o&&n<(R-_)*(o-S)/(C-S)+_&&(l=!l)}return l}function getHull(t){const e=t.slice();return e.sort((n,o)=>n.x<o.x?-1:n.x>o.x?1:n.y<o.y?-1:n.y>o.y?1:0),getHullPresorted(e)}function getHullPresorted(t){if(t.length<=1)return t.slice();const e=[];for(let o=0;o<t.length;o++){const l=t[o];for(;e.length>=2;){const d=e[e.length-1],f=e[e.length-2];if((d.x-f.x)*(l.y-f.y)>=(d.y-f.y)*(l.x-f.x))e.pop();else break}e.push(l)}e.pop();const n=[];for(let o=t.length-1;o>=0;o--){const l=t[o];for(;n.length>=2;){const d=n[n.length-1],f=n[n.length-2];if((d.x-f.x)*(l.y-f.y)>=(d.y-f.y)*(l.x-f.x))n.pop();else break}n.push(l)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var Provider$1=TooltipProvider$1,Root3=Tooltip$2,Trigger$3=TooltipTrigger$1,Portal$2=TooltipPortal,Content2$3=TooltipContent$1;const TooltipProvider=Provider$1,Tooltip$1=Root3,TooltipTrigger=Trigger$3,TooltipContent=React__namespace.forwardRef(({className:t,sideOffset:e=4,...n},o)=>jsxRuntime.jsx(Portal$2,{children:jsxRuntime.jsx(Content2$3,{ref:o,sideOffset:e,className:cn("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",t),...n})}));TooltipContent.displayName=Content2$3.displayName;const Input=React__namespace.forwardRef(({className:t,type:e,mask:n,onChange:o,placeholder:l,...d},f)=>{const[g,b]=React__namespace.useState(!1),_=React__namespace.useRef(null),R=l||(n==="phone"?"(999) 999-9999":n==="postal-code-ca"?"A9A 9A9":n==="zip-code-us"?"99999":""),C=()=>n==="phone"?"Only enter numbers. Formatting will be added automatically.":n==="postal-code-ca"?"Enter letters and numbers only. Spacing will be applied automatically.":n==="zip-code-us"?"Only enter numbers. Formatting will be added automatically.":"",E=()=>{b(!0),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{b(!1)},3e3)};React__namespace.useEffect(()=>()=>{_.current&&clearTimeout(_.current)},[]);const A=I=>{if(n){const M=I.target.value;let j=M;if(M.length>0){const q=M[M.length-1];/[^a-zA-Z0-9]/.test(q)&&(console.log("Non-alphanumeric detected:",q),E())}if(n==="phone"){const q=M.replace(/\D/g,"");q.length<=3?j=q:q.length<=6?j=`(${q.slice(0,3)}) ${q.slice(3)}`:j=`(${q.slice(0,3)}) ${q.slice(3,6)}-${q.slice(6,10)}`}else if(n==="postal-code-ca"){const q=M.replace(/[^a-zA-Z0-9]/g,"").toUpperCase();let z="";for(let Q=0;Q<Math.min(q.length,6);Q++){const F=q[Q];Q===0||Q===2||Q===4?/[A-Z]/.test(F)&&(z+=F):(Q===1||Q===3||Q===5)&&/[0-9]/.test(F)&&(z+=F)}z.length<=3?j=z:j=`${z.slice(0,3)} ${z.slice(3,6)}`}else if(n==="zip-code-us"){const q=M.replace(/\D/g,"");q.length<=5?j=q:j=`${q.slice(0,5)}-${q.slice(5,9)}`}I.target.value=j}o==null||o(I)};return jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{open:g&&!!n,children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx("input",{type:e,className:cn("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),onChange:A,placeholder:R,ref:f,...d})}),jsxRuntime.jsx(TooltipContent,{side:"top",className:"bg-sidebar text-sidebar-foreground",children:C()})]})})});Input.displayName="Input";var NAME$1="Separator",DEFAULT_ORIENTATION="horizontal",ORIENTATIONS=["horizontal","vertical"],Separator$2=React__namespace.forwardRef((t,e)=>{const{decorative:n,orientation:o=DEFAULT_ORIENTATION,...l}=t,d=isValidOrientation(o)?o:DEFAULT_ORIENTATION,g=n?{role:"none"}:{"aria-orientation":d==="vertical"?d:void 0,role:"separator"};return jsxRuntime.jsx(Primitive.div,{"data-orientation":d,...g,...l,ref:e})});Separator$2.displayName=NAME$1;function isValidOrientation(t){return ORIENTATIONS.includes(t)}var Root$5=Separator$2;const Separator$1=React__namespace.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...o},l)=>jsxRuntime.jsx(Root$5,{ref:l,decorative:n,orientation:e,className:cn("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...o}));Separator$1.displayName=Root$5.displayName;const Sheet=Root$8,SheetTrigger=Trigger$5,SheetClose=Close$1,SheetPortal=Portal$4,SheetOverlay=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Overlay,{className:cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));SheetOverlay.displayName=Overlay.displayName;const sheetVariants=cva("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),SheetContent=React__namespace.forwardRef(({side:t="right",className:e,children:n,...o},l)=>jsxRuntime.jsxs(SheetPortal,{children:[jsxRuntime.jsx(SheetOverlay,{}),jsxRuntime.jsxs(Content$2,{ref:l,className:cn(sheetVariants({side:t}),e),...o,children:[jsxRuntime.jsxs(Close$1,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[jsxRuntime.jsx(X$1,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Close"})]}),n]})]}));SheetContent.displayName=Content$2.displayName;const SheetHeader=({className:t,...e})=>jsxRuntime.jsx("div",{className:cn("flex flex-col space-y-2 text-center sm:text-left",t),...e});SheetHeader.displayName="SheetHeader";const SheetFooter=({className:t,...e})=>jsxRuntime.jsx("div",{className:cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});SheetFooter.displayName="SheetFooter";const SheetTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Title$1,{ref:n,className:cn("text-lg font-semibold text-foreground",t),...e}));SheetTitle.displayName=Title$1.displayName;const SheetDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Description$1,{ref:n,className:cn("text-sm text-muted-foreground",t),...e}));SheetDescription.displayName=Description$1.displayName;function AvatarFooter({onClick:t,publicName:e,applicationName:n,partnerId:o}){const l=`https://api.randmar.io/v4/Partner/${o}/Account/Logo?height=72&width=72`,[d,f]=React.useState(!1),g=()=>{f(!0)};return jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-muted "+(t!==void 0?"cursor-pointer":""),children:d?jsxRuntime.jsx(Button,{asChild:!0,size:"icon",onClick:t,children:jsxRuntime.jsx(TriangleAlert,{className:"h-5 w-5 text-muted-foreground !bg-sidebar"})}):jsxRuntime.jsx(Button,{asChild:!0,size:"icon",onClick:t,children:jsxRuntime.jsx("img",{src:l,alt:"Partner logo",className:"h-9 w-9 object-cover !bg-sidebar",onError:g})})}),jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:e||"Partner"}),jsxRuntime.jsx("span",{className:"text-xs text-neutral-400",children:n})]})]})}var NAME="Label",Label$3=React__namespace.forwardRef((t,e)=>jsxRuntime.jsx(Primitive.label,{...t,ref:e,onMouseDown:n=>{var l;n.target.closest("button, input, select, textarea")||((l=t.onMouseDown)==null||l.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Label$3.displayName=NAME;var Root$4=Label$3;function Label$2({className:t,...e}){return jsxRuntime.jsx(Root$4,{"data-slot":"label",className:cn("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}const MOBILE_BREAKPOINT=1024;function useIsMobile(){const[t,e]=React__namespace.useState(void 0);return React__namespace.useEffect(()=>{const n=window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT-1}px)`),o=()=>{e(window.innerWidth<MOBILE_BREAKPOINT)};return n.addEventListener("change",o),e(window.innerWidth<MOBILE_BREAKPOINT),()=>n.removeEventListener("change",o)},[]),!!t}function Skeleton({className:t,...e}){return jsxRuntime.jsx("div",{className:cn("animate-pulse rounded-md bg-primary/20",t),...e})}const SIDEBAR_COOKIE_NAME="sidebar:state",SIDEBAR_COOKIE_MAX_AGE=60*60*24*7,SIDEBAR_WIDTH="16rem",SIDEBAR_WIDTH_MOBILE="18rem",SIDEBAR_WIDTH_ICON="3rem",SIDEBAR_KEYBOARD_SHORTCUT="b",SidebarContext=React__namespace.createContext(null);function useSidebar(){const t=React__namespace.useContext(SidebarContext);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}const SidebarProvider=React__namespace.forwardRef(({defaultOpen:t=!0,open:e,onOpenChange:n,className:o,style:l,children:d,...f},g)=>{const b=useIsMobile(),[_,S]=React__namespace.useState(!1),[R,C]=React__namespace.useState(t),E=e??R,A=React__namespace.useCallback(q=>{const z=typeof q=="function"?q(E):q;n?n(z):C(z),document.cookie=`${SIDEBAR_COOKIE_NAME}=${z}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`},[n,E]),I=React__namespace.useCallback(()=>b?S(q=>!q):A(q=>!q),[b,A,S]);React__namespace.useEffect(()=>{const q=z=>{z.key===SIDEBAR_KEYBOARD_SHORTCUT&&(z.metaKey||z.ctrlKey)&&(z.preventDefault(),I())};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[I]);const M=E?"expanded":"collapsed",j=React__namespace.useMemo(()=>({state:M,open:E,setOpen:A,isMobile:b,openMobile:_,setOpenMobile:S,toggleSidebar:I}),[M,E,A,b,_,S,I]);return jsxRuntime.jsx(SidebarContext.Provider,{value:j,children:jsxRuntime.jsx(TooltipProvider,{delayDuration:0,children:jsxRuntime.jsx("div",{style:{"--sidebar-width":SIDEBAR_WIDTH,"--sidebar-width-icon":SIDEBAR_WIDTH_ICON,...l},className:cn("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",o),ref:g,...f,children:d})})})});SidebarProvider.displayName="SidebarProvider";const Sidebar=React__namespace.forwardRef(({side:t="left",variant:e="sidebar",collapsible:n="offcanvas",className:o,children:l,...d},f)=>{const{isMobile:g,state:b,openMobile:_,setOpenMobile:S}=useSidebar();return n==="none"?jsxRuntime.jsx("div",{className:cn("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",o),ref:f,...d,children:l}):g?jsxRuntime.jsx(Sheet,{open:_,onOpenChange:S,...d,children:jsxRuntime.jsx(SheetContent,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":SIDEBAR_WIDTH_MOBILE},side:t,children:jsxRuntime.jsx("div",{className:"flex h-full w-full flex-col",children:l})})}):jsxRuntime.jsxs("div",{ref:f,className:"group peer hidden md:block text-sidebar-foreground","data-state":b,"data-collapsible":b==="collapsed"?n:"","data-variant":e,"data-side":t,children:[jsxRuntime.jsx("div",{className:cn("duration-200 relative h-svh w-(--sidebar-width) bg-transparent transition-[width] ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",e==="floating"||e==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),jsxRuntime.jsx("div",{className:cn("duration-200 fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] ease-linear md:flex",t==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",e==="floating"||e==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",o),...d,children:jsxRuntime.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm",children:l})})]})});Sidebar.displayName="Sidebar";const SidebarTrigger=React__namespace.forwardRef(({className:t,onClick:e,...n},o)=>{const{toggleSidebar:l}=useSidebar();return jsxRuntime.jsxs(Button,{ref:o,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:cn("h-7 w-7 text-sidebar-foreground",t),onClick:d=>{e==null||e(d),l()},...n,children:[jsxRuntime.jsx(PanelLeft,{}),jsxRuntime.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});SidebarTrigger.displayName="SidebarTrigger";const SidebarRail=React__namespace.forwardRef(({className:t,...e},n)=>{const{toggleSidebar:o}=useSidebar();return jsxRuntime.jsx("button",{ref:n,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:o,title:"Toggle Sidebar",className:cn("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",t),...e})});SidebarRail.displayName="SidebarRail";const SidebarInset=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("main",{ref:n,className:cn("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-h-[calc(100svh-(--spacing(4)))] md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm",t),...e}));SidebarInset.displayName="SidebarInset";const SidebarInput=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Input,{ref:n,"data-sidebar":"input",className:cn("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",t),...e}));SidebarInput.displayName="SidebarInput";const SidebarHeader=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,"data-sidebar":"header",className:cn("flex flex-col gap-2 p-2",t),...e}));SidebarHeader.displayName="SidebarHeader";const SidebarFooter=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,"data-sidebar":"footer",className:cn("flex flex-col gap-2 p-2",t),...e}));SidebarFooter.displayName="SidebarFooter";const SidebarSeparator=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Separator$1,{ref:n,"data-sidebar":"separator",className:cn("mx-2 w-auto bg-sidebar-border",t),...e}));SidebarSeparator.displayName="SidebarSeparator";const SidebarContent=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,"data-sidebar":"content",className:cn("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...e}));SidebarContent.displayName="SidebarContent";const SidebarGroup=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,"data-sidebar":"group",className:cn("relative flex w-full min-w-0 flex-col p-2",t),...e}));SidebarGroup.displayName="SidebarGroup";const SidebarGroupLabel=React__namespace.forwardRef(({className:t,asChild:e=!1,...n},o)=>{const l=e?Slot$4:"div";return jsxRuntime.jsx(l,{ref:o,"data-sidebar":"group-label",className:cn("duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-hidden ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",t),...n})});SidebarGroupLabel.displayName="SidebarGroupLabel";const SidebarGroupAction=React__namespace.forwardRef(({className:t,asChild:e=!1,...n},o)=>{const l=e?Slot$4:"button";return jsxRuntime.jsx(l,{ref:o,"data-sidebar":"group-action",className:cn("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-hidden ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 md:after:hidden","group-data-[collapsible=icon]:hidden",t),...n})});SidebarGroupAction.displayName="SidebarGroupAction";const SidebarGroupContent=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,"data-sidebar":"group-content",className:cn("w-full text-sm",t),...e}));SidebarGroupContent.displayName="SidebarGroupContent";const SidebarMenu=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("ul",{ref:n,"data-sidebar":"menu",className:cn("flex w-full min-w-0 flex-col gap-1",t),...e}));SidebarMenu.displayName="SidebarMenu";const SidebarMenuItem=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("li",{ref:n,"data-sidebar":"menu-item",className:cn("group/menu-item relative",t),...e}));SidebarMenuItem.displayName="SidebarMenuItem";const sidebarMenuButtonVariants=cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}}),SidebarMenuButton=React__namespace.forwardRef(({asChild:t=!1,isActive:e=!1,variant:n="default",size:o="default",tooltip:l,className:d,...f},g)=>{const b=t?Slot$4:"button",{isMobile:_,state:S}=useSidebar(),R=jsxRuntime.jsx(b,{ref:g,"data-sidebar":"menu-button","data-size":o,"data-active":e,className:cn(sidebarMenuButtonVariants({variant:n,size:o}),d),...f});return l?(typeof l=="string"&&(l={children:l}),jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:R}),jsxRuntime.jsx(TooltipContent,{side:"right",align:"center",hidden:S!=="collapsed"||_,...l})]})):R});SidebarMenuButton.displayName="SidebarMenuButton";const SidebarMenuAction=React__namespace.forwardRef(({className:t,asChild:e=!1,showOnHover:n=!1,...o},l)=>{const d=e?Slot$4:"button";return jsxRuntime.jsx(d,{ref:l,"data-sidebar":"menu-action",className:cn("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-hidden ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 md:after:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",n&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",t),...o})});SidebarMenuAction.displayName="SidebarMenuAction";const SidebarMenuBadge=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,"data-sidebar":"menu-badge",className:cn("absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",t),...e}));SidebarMenuBadge.displayName="SidebarMenuBadge";const SidebarMenuSkeleton=React__namespace.forwardRef(({className:t,showIcon:e=!1,...n},o)=>{const l=React__namespace.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return jsxRuntime.jsxs("div",{ref:o,"data-sidebar":"menu-skeleton",className:cn("rounded-md h-8 flex gap-2 px-2 items-center",t),...n,children:[e&&jsxRuntime.jsx(Skeleton,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),jsxRuntime.jsx(Skeleton,{className:"h-4 flex-1 max-w-(--skeleton-width)","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":l}})]})});SidebarMenuSkeleton.displayName="SidebarMenuSkeleton";const SidebarMenuSub=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("ul",{ref:n,"data-sidebar":"menu-sub",className:cn("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",t),...e}));SidebarMenuSub.displayName="SidebarMenuSub";const SidebarMenuSubItem=React__namespace.forwardRef(({...t},e)=>jsxRuntime.jsx("li",{ref:e,...t}));SidebarMenuSubItem.displayName="SidebarMenuSubItem";const SidebarMenuSubButton=React__namespace.forwardRef(({asChild:t=!1,size:e="md",isActive:n,className:o,...l},d)=>{const f=t?Slot$4:"a";return jsxRuntime.jsx(f,{ref:d,"data-sidebar":"menu-sub-button","data-size":e,"data-active":n,className:cn("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-hidden ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",e==="sm"&&"text-xs",e==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",o),...l})});SidebarMenuSubButton.displayName="SidebarMenuSubButton";var PROVIDER_NAME="ToastProvider",[Collection$1,useCollection$1,createCollectionScope$1]=createCollection("Toast"),[createToastContext,createToastScope]=createContextScope("Toast",[createCollectionScope$1]),[ToastProviderProvider,useToastProviderContext]=createToastContext(PROVIDER_NAME),ToastProvider$1=t=>{const{__scopeToast:e,label:n="Notification",duration:o=5e3,swipeDirection:l="right",swipeThreshold:d=50,children:f}=t,[g,b]=React__namespace.useState(null),[_,S]=React__namespace.useState(0),R=React__namespace.useRef(!1),C=React__namespace.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${PROVIDER_NAME}\`. Expected non-empty \`string\`.`),jsxRuntime.jsx(Collection$1.Provider,{scope:e,children:jsxRuntime.jsx(ToastProviderProvider,{scope:e,label:n,duration:o,swipeDirection:l,swipeThreshold:d,toastCount:_,viewport:g,onViewportChange:b,onToastAdd:React__namespace.useCallback(()=>S(E=>E+1),[]),onToastRemove:React__namespace.useCallback(()=>S(E=>E-1),[]),isFocusedToastEscapeKeyDownRef:R,isClosePausedRef:C,children:f})})};ToastProvider$1.displayName=PROVIDER_NAME;var VIEWPORT_NAME$2="ToastViewport",VIEWPORT_DEFAULT_HOTKEY=["F8"],VIEWPORT_PAUSE="toast.viewportPause",VIEWPORT_RESUME="toast.viewportResume",ToastViewport$1=React__namespace.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:o=VIEWPORT_DEFAULT_HOTKEY,label:l="Notifications ({hotkey})",...d}=t,f=useToastProviderContext(VIEWPORT_NAME$2,n),g=useCollection$1(n),b=React__namespace.useRef(null),_=React__namespace.useRef(null),S=React__namespace.useRef(null),R=React__namespace.useRef(null),C=useComposedRefs(e,R,f.onViewportChange),E=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),A=f.toastCount>0;React__namespace.useEffect(()=>{const M=j=>{var z;o.length!==0&&o.every(Q=>j[Q]||j.code===Q)&&((z=R.current)==null||z.focus())};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[o]),React__namespace.useEffect(()=>{const M=b.current,j=R.current;if(A&&M&&j){const q=()=>{if(!f.isClosePausedRef.current){const O=new CustomEvent(VIEWPORT_PAUSE);j.dispatchEvent(O),f.isClosePausedRef.current=!0}},z=()=>{if(f.isClosePausedRef.current){const O=new CustomEvent(VIEWPORT_RESUME);j.dispatchEvent(O),f.isClosePausedRef.current=!1}},Q=O=>{!M.contains(O.relatedTarget)&&z()},F=()=>{M.contains(document.activeElement)||z()};return M.addEventListener("focusin",q),M.addEventListener("focusout",Q),M.addEventListener("pointermove",q),M.addEventListener("pointerleave",F),window.addEventListener("blur",q),window.addEventListener("focus",z),()=>{M.removeEventListener("focusin",q),M.removeEventListener("focusout",Q),M.removeEventListener("pointermove",q),M.removeEventListener("pointerleave",F),window.removeEventListener("blur",q),window.removeEventListener("focus",z)}}},[A,f.isClosePausedRef]);const I=React__namespace.useCallback(({tabbingDirection:M})=>{const q=g().map(z=>{const Q=z.ref.current,F=[Q,...getTabbableCandidates(Q)];return M==="forwards"?F:F.reverse()});return(M==="forwards"?q.reverse():q).flat()},[g]);return React__namespace.useEffect(()=>{const M=R.current;if(M){const j=q=>{var F,O,te;const z=q.altKey||q.ctrlKey||q.metaKey;if(q.key==="Tab"&&!z){const ne=document.activeElement,ae=q.shiftKey;if(q.target===M&&ae){(F=_.current)==null||F.focus();return}const je=I({tabbingDirection:ae?"backwards":"forwards"}),Ne=je.findIndex(Ae=>Ae===ne);focusFirst(je.slice(Ne+1))?q.preventDefault():ae?(O=_.current)==null||O.focus():(te=S.current)==null||te.focus()}};return M.addEventListener("keydown",j),()=>M.removeEventListener("keydown",j)}},[g,I]),jsxRuntime.jsxs(Branch$1,{ref:b,role:"region","aria-label":l.replace("{hotkey}",E),tabIndex:-1,style:{pointerEvents:A?void 0:"none"},children:[A&&jsxRuntime.jsx(FocusProxy,{ref:_,onFocusFromOutsideViewport:()=>{const M=I({tabbingDirection:"forwards"});focusFirst(M)}}),jsxRuntime.jsx(Collection$1.Slot,{scope:n,children:jsxRuntime.jsx(Primitive.ol,{tabIndex:-1,...d,ref:C})}),A&&jsxRuntime.jsx(FocusProxy,{ref:S,onFocusFromOutsideViewport:()=>{const M=I({tabbingDirection:"backwards"});focusFirst(M)}})]})});ToastViewport$1.displayName=VIEWPORT_NAME$2;var FOCUS_PROXY_NAME="ToastFocusProxy",FocusProxy=React__namespace.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:o,...l}=t,d=useToastProviderContext(FOCUS_PROXY_NAME,n);return jsxRuntime.jsx(VisuallyHidden,{"aria-hidden":!0,tabIndex:0,...l,ref:e,style:{position:"fixed"},onFocus:f=>{var _;const g=f.relatedTarget;!((_=d.viewport)!=null&&_.contains(g))&&o()}})});FocusProxy.displayName=FOCUS_PROXY_NAME;var TOAST_NAME="Toast",TOAST_SWIPE_START="toast.swipeStart",TOAST_SWIPE_MOVE="toast.swipeMove",TOAST_SWIPE_CANCEL="toast.swipeCancel",TOAST_SWIPE_END="toast.swipeEnd",Toast$1=React__namespace.forwardRef((t,e)=>{const{forceMount:n,open:o,defaultOpen:l,onOpenChange:d,...f}=t,[g,b]=useControllableState({prop:o,defaultProp:l??!0,onChange:d,caller:TOAST_NAME});return jsxRuntime.jsx(Presence,{present:n||g,children:jsxRuntime.jsx(ToastImpl,{open:g,...f,ref:e,onClose:()=>b(!1),onPause:useCallbackRef$1(t.onPause),onResume:useCallbackRef$1(t.onResume),onSwipeStart:composeEventHandlers(t.onSwipeStart,_=>{_.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:composeEventHandlers(t.onSwipeMove,_=>{const{x:S,y:R}=_.detail.delta;_.currentTarget.setAttribute("data-swipe","move"),_.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${S}px`),_.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${R}px`)}),onSwipeCancel:composeEventHandlers(t.onSwipeCancel,_=>{_.currentTarget.setAttribute("data-swipe","cancel"),_.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),_.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),_.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),_.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:composeEventHandlers(t.onSwipeEnd,_=>{const{x:S,y:R}=_.detail.delta;_.currentTarget.setAttribute("data-swipe","end"),_.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),_.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),_.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${S}px`),_.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${R}px`),b(!1)})})})});Toast$1.displayName=TOAST_NAME;var[ToastInteractiveProvider,useToastInteractiveContext]=createToastContext(TOAST_NAME,{onClose(){}}),ToastImpl=React__namespace.forwardRef((t,e)=>{const{__scopeToast:n,type:o="foreground",duration:l,open:d,onClose:f,onEscapeKeyDown:g,onPause:b,onResume:_,onSwipeStart:S,onSwipeMove:R,onSwipeCancel:C,onSwipeEnd:E,...A}=t,I=useToastProviderContext(TOAST_NAME,n),[M,j]=React__namespace.useState(null),q=useComposedRefs(e,Ae=>j(Ae)),z=React__namespace.useRef(null),Q=React__namespace.useRef(null),F=l||I.duration,O=React__namespace.useRef(0),te=React__namespace.useRef(F),ne=React__namespace.useRef(0),{onToastAdd:ae,onToastRemove:ge}=I,oe=useCallbackRef$1(()=>{var $e;(M==null?void 0:M.contains(document.activeElement))&&(($e=I.viewport)==null||$e.focus()),f()}),je=React__namespace.useCallback(Ae=>{!Ae||Ae===1/0||(window.clearTimeout(ne.current),O.current=new Date().getTime(),ne.current=window.setTimeout(oe,Ae))},[oe]);React__namespace.useEffect(()=>{const Ae=I.viewport;if(Ae){const $e=()=>{je(te.current),_==null||_()},Fe=()=>{const ze=new Date().getTime()-O.current;te.current=te.current-ze,window.clearTimeout(ne.current),b==null||b()};return Ae.addEventListener(VIEWPORT_PAUSE,Fe),Ae.addEventListener(VIEWPORT_RESUME,$e),()=>{Ae.removeEventListener(VIEWPORT_PAUSE,Fe),Ae.removeEventListener(VIEWPORT_RESUME,$e)}}},[I.viewport,F,b,_,je]),React__namespace.useEffect(()=>{d&&!I.isClosePausedRef.current&&je(F)},[d,F,I.isClosePausedRef,je]),React__namespace.useEffect(()=>(ae(),()=>ge()),[ae,ge]);const Ne=React__namespace.useMemo(()=>M?getAnnounceTextContent(M):null,[M]);return I.viewport?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Ne&&jsxRuntime.jsx(ToastAnnounce,{__scopeToast:n,role:"status","aria-live":o==="foreground"?"assertive":"polite","aria-atomic":!0,children:Ne}),jsxRuntime.jsx(ToastInteractiveProvider,{scope:n,onClose:oe,children:ReactDOM__namespace.createPortal(jsxRuntime.jsx(Collection$1.ItemSlot,{scope:n,children:jsxRuntime.jsx(Root$9,{asChild:!0,onEscapeKeyDown:composeEventHandlers(g,()=>{I.isFocusedToastEscapeKeyDownRef.current||oe(),I.isFocusedToastEscapeKeyDownRef.current=!1}),children:jsxRuntime.jsx(Primitive.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":d?"open":"closed","data-swipe-direction":I.swipeDirection,...A,ref:q,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:composeEventHandlers(t.onKeyDown,Ae=>{Ae.key==="Escape"&&(g==null||g(Ae.nativeEvent),Ae.nativeEvent.defaultPrevented||(I.isFocusedToastEscapeKeyDownRef.current=!0,oe()))}),onPointerDown:composeEventHandlers(t.onPointerDown,Ae=>{Ae.button===0&&(z.current={x:Ae.clientX,y:Ae.clientY})}),onPointerMove:composeEventHandlers(t.onPointerMove,Ae=>{if(!z.current)return;const $e=Ae.clientX-z.current.x,Fe=Ae.clientY-z.current.y,ze=!!Q.current,Ve=["left","right"].includes(I.swipeDirection),Be=["left","up"].includes(I.swipeDirection)?Math.min:Math.max,qe=Ve?Be(0,$e):0,Ke=Ve?0:Be(0,Fe),He=Ae.pointerType==="touch"?10:2,Xe={x:qe,y:Ke},tt={originalEvent:Ae,delta:Xe};ze?(Q.current=Xe,handleAndDispatchCustomEvent(TOAST_SWIPE_MOVE,R,tt,{discrete:!1})):isDeltaInDirection(Xe,I.swipeDirection,He)?(Q.current=Xe,handleAndDispatchCustomEvent(TOAST_SWIPE_START,S,tt,{discrete:!1}),Ae.target.setPointerCapture(Ae.pointerId)):(Math.abs($e)>He||Math.abs(Fe)>He)&&(z.current=null)}),onPointerUp:composeEventHandlers(t.onPointerUp,Ae=>{const $e=Q.current,Fe=Ae.target;if(Fe.hasPointerCapture(Ae.pointerId)&&Fe.releasePointerCapture(Ae.pointerId),Q.current=null,z.current=null,$e){const ze=Ae.currentTarget,Ve={originalEvent:Ae,delta:$e};isDeltaInDirection($e,I.swipeDirection,I.swipeThreshold)?handleAndDispatchCustomEvent(TOAST_SWIPE_END,E,Ve,{discrete:!0}):handleAndDispatchCustomEvent(TOAST_SWIPE_CANCEL,C,Ve,{discrete:!0}),ze.addEventListener("click",Be=>Be.preventDefault(),{once:!0})}})})})}),I.viewport)})]}):null}),ToastAnnounce=t=>{const{__scopeToast:e,children:n,...o}=t,l=useToastProviderContext(TOAST_NAME,e),[d,f]=React__namespace.useState(!1),[g,b]=React__namespace.useState(!1);return useNextFrame(()=>f(!0)),React__namespace.useEffect(()=>{const _=window.setTimeout(()=>b(!0),1e3);return()=>window.clearTimeout(_)},[]),g?null:jsxRuntime.jsx(Portal$5,{asChild:!0,children:jsxRuntime.jsx(VisuallyHidden,{...o,children:d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[l.label," ",n]})})})},TITLE_NAME$1="ToastTitle",ToastTitle$1=React__namespace.forwardRef((t,e)=>{const{__scopeToast:n,...o}=t;return jsxRuntime.jsx(Primitive.div,{...o,ref:e})});ToastTitle$1.displayName=TITLE_NAME$1;var DESCRIPTION_NAME$1="ToastDescription",ToastDescription$1=React__namespace.forwardRef((t,e)=>{const{__scopeToast:n,...o}=t;return jsxRuntime.jsx(Primitive.div,{...o,ref:e})});ToastDescription$1.displayName=DESCRIPTION_NAME$1;var ACTION_NAME$1="ToastAction",ToastAction$1=React__namespace.forwardRef((t,e)=>{const{altText:n,...o}=t;return n.trim()?jsxRuntime.jsx(ToastAnnounceExclude,{altText:n,asChild:!0,children:jsxRuntime.jsx(ToastClose$1,{...o,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${ACTION_NAME$1}\`. Expected non-empty \`string\`.`),null)});ToastAction$1.displayName=ACTION_NAME$1;var CLOSE_NAME$1="ToastClose",ToastClose$1=React__namespace.forwardRef((t,e)=>{const{__scopeToast:n,...o}=t,l=useToastInteractiveContext(CLOSE_NAME$1,n);return jsxRuntime.jsx(ToastAnnounceExclude,{asChild:!0,children:jsxRuntime.jsx(Primitive.button,{type:"button",...o,ref:e,onClick:composeEventHandlers(t.onClick,l.onClose)})})});ToastClose$1.displayName=CLOSE_NAME$1;var ToastAnnounceExclude=React__namespace.forwardRef((t,e)=>{const{__scopeToast:n,altText:o,...l}=t;return jsxRuntime.jsx(Primitive.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":o||void 0,...l,ref:e})});function getAnnounceTextContent(t){const e=[];return Array.from(t.childNodes).forEach(o=>{if(o.nodeType===o.TEXT_NODE&&o.textContent&&e.push(o.textContent),isHTMLElement$1(o)){const l=o.ariaHidden||o.hidden||o.style.display==="none",d=o.dataset.radixToastAnnounceExclude==="";if(!l)if(d){const f=o.dataset.radixToastAnnounceAlt;f&&e.push(f)}else e.push(...getAnnounceTextContent(o))}}),e}function handleAndDispatchCustomEvent(t,e,n,{discrete:o}){const l=n.originalEvent.currentTarget,d=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&l.addEventListener(t,e,{once:!0}),o?dispatchDiscreteCustomEvent(l,d):l.dispatchEvent(d)}var isDeltaInDirection=(t,e,n=0)=>{const o=Math.abs(t.x),l=Math.abs(t.y),d=o>l;return e==="left"||e==="right"?d&&o>n:!d&&l>n};function useNextFrame(t=()=>{}){const e=useCallbackRef$1(t);useLayoutEffect2(()=>{let n=0,o=0;return n=window.requestAnimationFrame(()=>o=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(o)}},[e])}function isHTMLElement$1(t){return t.nodeType===t.ELEMENT_NODE}function getTabbableCandidates(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 focusFirst(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var Provider=ToastProvider$1,Viewport$2=ToastViewport$1,Root2$4=Toast$1,Title=ToastTitle$1,Description=ToastDescription$1,Action$1=ToastAction$1,Close=ToastClose$1;const ToastProvider=Provider,ToastViewport=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Viewport$2,{ref:n,className:cn("fixed top-0 z-100 flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));ToastViewport.displayName=Viewport$2.displayName;const toastVariants=cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full sm:data-[state=open]:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground",success:"border-green-600 bg-green-600 text-white",warning:"border-yellow-500 bg-yellow-500 text-white",info:"border-blue-500 bg-blue-500 text-white",secondary:"border-secondary bg-secondary text-secondary-foreground",outline:"border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground"}},defaultVariants:{variant:"default"}}),Toast=React__namespace.forwardRef(({className:t,variant:e,...n},o)=>jsxRuntime.jsx(Root2$4,{ref:o,className:cn(toastVariants({variant:e}),t),...n}));Toast.displayName=Root2$4.displayName;const ToastAction=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Action$1,{ref:n,className:cn("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-hidden focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 hover:group-[.destructive]:border-destructive/30 hover:group-[.destructive]:bg-destructive hover:group-[.destructive]:text-destructive-foreground focus:group-[.destructive]:ring-destructive",t),...e}));ToastAction.displayName=Action$1.displayName;const ToastClose=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Close,{ref:n,className:cn("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-hidden focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 hover:group-[.destructive]:text-red-50 focus:group-[.destructive]:ring-red-400 focus:group-[.destructive]:ring-offset-red-600",t),"toast-close":"",...e,children:jsxRuntime.jsx(X$1,{className:"h-4 w-4"})}));ToastClose.displayName=Close.displayName;const ToastTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Title,{ref:n,className:cn("text-sm font-semibold [&+div]:text-xs",t),...e}));ToastTitle.displayName=Title.displayName;const ToastDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Description,{ref:n,className:cn("text-sm opacity-90",t),...e}));ToastDescription.displayName=Description.displayName;const TOAST_LIMIT=1,TOAST_REMOVE_DELAY=1e6;let count$1=0;function genId(){return count$1=(count$1+1)%Number.MAX_SAFE_INTEGER,count$1.toString()}const toastTimeouts=new Map,addToRemoveQueue=t=>{if(toastTimeouts.has(t))return;const e=setTimeout(()=>{toastTimeouts.delete(t),dispatch({type:"REMOVE_TOAST",toastId:t})},TOAST_REMOVE_DELAY);toastTimeouts.set(t,e)},reducer=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,TOAST_LIMIT)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?addToRemoveQueue(n):t.toasts.forEach(o=>addToRemoveQueue(o.id)),{...t,toasts:t.toasts.map(o=>o.id===n||n===void 0?{...o,open:!1}:o)}}case"REMOVE_TOAST":return{...t,toasts:e.toastId?t.toasts.filter(n=>n.id!==e.toastId):[]}}},listeners=[];let memoryState={toasts:[]};function dispatch(t){memoryState=reducer(memoryState,t),listeners.forEach(e=>e(memoryState))}function toast({...t}){const e=genId(),n=l=>dispatch({type:"UPDATE_TOAST",toast:{...l,id:e}}),o=()=>dispatch({type:"DISMISS_TOAST",toastId:e});return dispatch({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:l=>{l||o()}}}),{id:e,dismiss:o,update:n}}function useToast(){const[t,e]=React__namespace.useState(memoryState);return React__namespace.useEffect(()=>(listeners.push(e),()=>{const n=listeners.indexOf(e);n>-1&&listeners.splice(n,1)}),[]),{...t,toast,dismiss:n=>dispatch({type:"DISMISS_TOAST",toastId:n})}}function Toaster(){const{toasts:t}=useToast();return jsxRuntime.jsxs(ToastProvider,{children:[t.map(function({id:e,title:n,description:o,action:l,...d}){return jsxRuntime.jsxs(Toast,{...d,children:[jsxRuntime.jsxs("div",{className:"grid gap-1",children:[n&&jsxRuntime.jsx(ToastTitle,{children:n}),o&&jsxRuntime.jsx(ToastDescription,{children:o})]}),l,jsxRuntime.jsx(ToastClose,{})]},e)}),jsxRuntime.jsx(ToastViewport,{})]})}const ChatContext=React.createContext(void 0),ChatProvider=({children:t})=>{const e=React.useRef(null),n=(o=-1,l)=>e.current?(e.current.setActiveChatAndSendMessage(o,l),!0):!1;return jsxRuntime.jsx(ChatContext.Provider,{value:{sendMessage:n,chatRef:e},children:t})},useChat=()=>{const t=React.useContext(ChatContext);if(t===void 0)throw new Error("useChat must be used within a ChatProvider");return t};function formatProdErrorMessage$1(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var randomString=()=>Math.random().toString(36).substring(7).split("").join("."),ActionTypes={INIT:`@@redux/INIT${randomString()}`,REPLACE:`@@redux/REPLACE${randomString()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${randomString()}`},actionTypes_default=ActionTypes;function isPlainObject$4(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function miniKindOf(t){if(t===void 0)return"undefined";if(t===null)return"null";const e=typeof t;switch(e){case"boolean":case"string":case"number":case"symbol":case"function":return e}if(Array.isArray(t))return"array";if(isDate(t))return"date";if(isError(t))return"error";const n=ctorName(t);switch(n){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return n}return Object.prototype.toString.call(t).slice(8,-1).toLowerCase().replace(/\s/g,"")}function ctorName(t){return typeof t.constructor=="function"?t.constructor.name:null}function isError(t){return t instanceof Error||typeof t.message=="string"&&t.constructor&&typeof t.constructor.stackTraceLimit=="number"}function isDate(t){return t instanceof Date?!0:typeof t.toDateString=="function"&&typeof t.getDate=="function"&&typeof t.setDate=="function"}function kindOf(t){let e=typeof t;return process.env.NODE_ENV!=="production"&&(e=miniKindOf(t)),e}function warning(t){typeof console<"u"&&typeof console.error=="function"&&console.error(t);try{throw new Error(t)}catch{}}function getUnexpectedStateShapeWarningMessage(t,e,n,o){const l=Object.keys(e),d=n&&n.type===actionTypes_default.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(l.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!isPlainObject$4(t))return`The ${d} has unexpected type of "${kindOf(t)}". Expected argument to be an object with the following keys: "${l.join('", "')}"`;const f=Object.keys(t).filter(g=>!e.hasOwnProperty(g)&&!o[g]);if(f.forEach(g=>{o[g]=!0}),!(n&&n.type===actionTypes_default.REPLACE)&&f.length>0)return`Unexpected ${f.length>1?"keys":"key"} "${f.join('", "')}" found in ${d}. Expected to find one of the known reducer keys instead: "${l.join('", "')}". Unexpected keys will be ignored.`}function assertReducerShape(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:actionTypes_default.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage$1(12):`The slice reducer for key "${e}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof n(void 0,{type:actionTypes_default.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage$1(13):`The slice reducer for key "${e}" returned undefined when probed with a random type. Don't try to handle '${actionTypes_default.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)})}function combineReducers(t){const e=Object.keys(t),n={};for(let f=0;f<e.length;f++){const g=e[f];process.env.NODE_ENV!=="production"&&typeof t[g]>"u"&&warning(`No reducer provided for key "${g}"`),typeof t[g]=="function"&&(n[g]=t[g])}const o=Object.keys(n);let l;process.env.NODE_ENV!=="production"&&(l={});let d;try{assertReducerShape(n)}catch(f){d=f}return function(g={},b){if(d)throw d;if(process.env.NODE_ENV!=="production"){const R=getUnexpectedStateShapeWarningMessage(g,n,b,l);R&&warning(R)}let _=!1;const S={};for(let R=0;R<o.length;R++){const C=o[R],E=n[C],A=g[C],I=E(A,b);if(typeof I>"u"){const M=b&&b.type;throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage$1(14):`When called with an action of type ${M?`"${String(M)}"`:"(unknown type)"}, the slice reducer for key "${C}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}S[C]=I,_=_||I!==A}return _=_||o.length!==Object.keys(g).length,_?S:g}}function isAction(t){return isPlainObject$4(t)&&"type"in t&&typeof t.type=="string"}var NOTHING=Symbol.for("immer-nothing"),DRAFTABLE=Symbol.for("immer-draftable"),DRAFT_STATE=Symbol.for("immer-state"),errors=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function die(t,...e){if(process.env.NODE_ENV!=="production"){const n=errors[t],o=typeof n=="function"?n.apply(null,e):n;throw new Error(`[Immer] ${o}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var getPrototypeOf=Object.getPrototypeOf;function isDraft(t){return!!t&&!!t[DRAFT_STATE]}function isDraftable(t){var e;return t?isPlainObject$3(t)||Array.isArray(t)||!!t[DRAFTABLE]||!!((e=t.constructor)!=null&&e[DRAFTABLE])||isMap(t)||isSet(t):!1}var objectCtorString=Object.prototype.constructor.toString();function isPlainObject$3(t){if(!t||typeof t!="object")return!1;const e=getPrototypeOf(t);if(e===null)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===objectCtorString}function original(t){return isDraft(t)||die(15,t),t[DRAFT_STATE].base_}function each(t,e){getArchtype(t)===0?Reflect.ownKeys(t).forEach(n=>{e(n,t[n],t)}):t.forEach((n,o)=>e(o,n,t))}function getArchtype(t){const e=t[DRAFT_STATE];return e?e.type_:Array.isArray(t)?1:isMap(t)?2:isSet(t)?3:0}function has$1(t,e){return getArchtype(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function get$2(t,e){return getArchtype(t)===2?t.get(e):t[e]}function set$1(t,e,n){const o=getArchtype(t);o===2?t.set(e,n):o===3?t.add(n):t[e]=n}function is$1(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function isMap(t){return t instanceof Map}function isSet(t){return t instanceof Set}function latest(t){return t.copy_||t.base_}function shallowCopy(t,e){if(isMap(t))return new Map(t);if(isSet(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=isPlainObject$3(t);if(e===!0||e==="class_only"&&!n){const o=Object.getOwnPropertyDescriptors(t);delete o[DRAFT_STATE];let l=Reflect.ownKeys(o);for(let d=0;d<l.length;d++){const f=l[d],g=o[f];g.writable===!1&&(g.writable=!0,g.configurable=!0),(g.get||g.set)&&(o[f]={configurable:!0,writable:!0,enumerable:g.enumerable,value:t[f]})}return Object.create(getPrototypeOf(t),o)}else{const o=getPrototypeOf(t);if(o!==null&&n)return{...t};const l=Object.create(o);return Object.assign(l,t)}}function freeze(t,e=!1){return isFrozen(t)||isDraft(t)||!isDraftable(t)||(getArchtype(t)>1&&(t.set=t.add=t.clear=t.delete=dontMutateFrozenCollections),Object.freeze(t),e&&Object.entries(t).forEach(([n,o])=>freeze(o,!0))),t}function dontMutateFrozenCollections(){die(2)}function isFrozen(t){return Object.isFrozen(t)}var plugins={};function getPlugin(t){const e=plugins[t];return e||die(0,t),e}function loadPlugin(t,e){plugins[t]||(plugins[t]=e)}var currentScope;function getCurrentScope(){return currentScope}function createScope(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function usePatchesInScope(t,e){e&&(getPlugin("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function revokeScope(t){leaveScope(t),t.drafts_.forEach(revokeDraft),t.drafts_=null}function leaveScope(t){t===currentScope&&(currentScope=t.parent_)}function enterScope(t){return currentScope=createScope(currentScope,t)}function revokeDraft(t){const e=t[DRAFT_STATE];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function processResult(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[DRAFT_STATE].modified_&&(revokeScope(e),die(4)),isDraftable(t)&&(t=finalize(e,t),e.parent_||maybeFreeze(e,t)),e.patches_&&getPlugin("Patches").generateReplacementPatches_(n[DRAFT_STATE].base_,t,e.patches_,e.inversePatches_)):t=finalize(e,n,[]),revokeScope(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==NOTHING?t:void 0}function finalize(t,e,n){if(isFrozen(e))return e;const o=e[DRAFT_STATE];if(!o)return each(e,(l,d)=>finalizeProperty(t,o,e,l,d,n)),e;if(o.scope_!==t)return e;if(!o.modified_)return maybeFreeze(t,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const l=o.copy_;let d=l,f=!1;o.type_===3&&(d=new Set(l),l.clear(),f=!0),each(d,(g,b)=>finalizeProperty(t,o,l,g,b,n,f)),maybeFreeze(t,l,!1),n&&t.patches_&&getPlugin("Patches").generatePatches_(o,n,t.patches_,t.inversePatches_)}return o.copy_}function finalizeProperty(t,e,n,o,l,d,f){if(process.env.NODE_ENV!=="production"&&l===n&&die(5),isDraft(l)){const g=d&&e&&e.type_!==3&&!has$1(e.assigned_,o)?d.concat(o):void 0,b=finalize(t,l,g);if(set$1(n,o,b),isDraft(b))t.canAutoFreeze_=!1;else return}else f&&n.add(l);if(isDraftable(l)&&!isFrozen(l)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;finalize(t,l),(!e||!e.scope_.parent_)&&typeof o!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,o)&&maybeFreeze(t,l)}}function maybeFreeze(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&freeze(e,n)}function createProxyProxy(t,e){const n=Array.isArray(t),o={type_:n?1:0,scope_:e?e.scope_:getCurrentScope(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let l=o,d=objectTraps;n&&(l=[o],d=arrayTraps);const{revoke:f,proxy:g}=Proxy.revocable(l,d);return o.draft_=g,o.revoke_=f,g}var objectTraps={get(t,e){if(e===DRAFT_STATE)return t;const n=latest(t);if(!has$1(n,e))return readPropFromProto(t,n,e);const o=n[e];return t.finalized_||!isDraftable(o)?o:o===peek(t.base_,e)?(prepareCopy(t),t.copy_[e]=createProxy(o,t)):o},has(t,e){return e in latest(t)},ownKeys(t){return Reflect.ownKeys(latest(t))},set(t,e,n){const o=getDescriptorFromProto(latest(t),e);if(o!=null&&o.set)return o.set.call(t.draft_,n),!0;if(!t.modified_){const l=peek(latest(t),e),d=l==null?void 0:l[DRAFT_STATE];if(d&&d.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(is$1(n,l)&&(n!==void 0||has$1(t.base_,e)))return!0;prepareCopy(t),markChanged(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return peek(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,prepareCopy(t),markChanged(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=latest(t),o=Reflect.getOwnPropertyDescriptor(n,e);return o&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:o.enumerable,value:n[e]}},defineProperty(){die(11)},getPrototypeOf(t){return getPrototypeOf(t.base_)},setPrototypeOf(){die(12)}},arrayTraps={};each(objectTraps,(t,e)=>{arrayTraps[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}}),arrayTraps.deleteProperty=function(t,e){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(e))&&die(13),arrayTraps.set.call(this,t,e,void 0)},arrayTraps.set=function(t,e,n){return process.env.NODE_ENV!=="production"&&e!=="length"&&isNaN(parseInt(e))&&die(14),objectTraps.set.call(this,t[0],e,n,t[0])};function peek(t,e){const n=t[DRAFT_STATE];return(n?latest(n):t)[e]}function readPropFromProto(t,e,n){var l;const o=getDescriptorFromProto(e,n);return o?"value"in o?o.value:(l=o.get)==null?void 0:l.call(t.draft_):void 0}function getDescriptorFromProto(t,e){if(!(e in t))return;let n=getPrototypeOf(t);for(;n;){const o=Object.getOwnPropertyDescriptor(n,e);if(o)return o;n=getPrototypeOf(n)}}function markChanged(t){t.modified_||(t.modified_=!0,t.parent_&&markChanged(t.parent_))}function prepareCopy(t){t.copy_||(t.copy_=shallowCopy(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Immer2=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,n,o)=>{if(typeof e=="function"&&typeof n!="function"){const d=n;n=e;const f=this;return function(b=d,..._){return f.produce(b,S=>n.call(this,S,..._))}}typeof n!="function"&&die(6),o!==void 0&&typeof o!="function"&&die(7);let l;if(isDraftable(e)){const d=enterScope(this),f=createProxy(e,void 0);let g=!0;try{l=n(f),g=!1}finally{g?revokeScope(d):leaveScope(d)}return usePatchesInScope(d,o),processResult(l,d)}else if(!e||typeof e!="object"){if(l=n(e),l===void 0&&(l=e),l===NOTHING&&(l=void 0),this.autoFreeze_&&freeze(l,!0),o){const d=[],f=[];getPlugin("Patches").generateReplacementPatches_(e,l,d,f),o(d,f)}return l}else die(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(f,...g)=>this.produceWithPatches(f,b=>e(b,...g));let o,l;return[this.produce(e,n,(f,g)=>{o=f,l=g}),o,l]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){isDraftable(t)||die(8),isDraft(t)&&(t=current(t));const e=enterScope(this),n=createProxy(t,void 0);return n[DRAFT_STATE].isManual_=!0,leaveScope(e),n}finishDraft(t,e){const n=t&&t[DRAFT_STATE];(!n||!n.isManual_)&&die(9);const{scope_:o}=n;return usePatchesInScope(o,e),processResult(void 0,o)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const l=e[n];if(l.path.length===0&&l.op==="replace"){t=l.value;break}}n>-1&&(e=e.slice(n+1));const o=getPlugin("Patches").applyPatches_;return isDraft(t)?o(t,e):this.produce(t,l=>o(l,e))}};function createProxy(t,e){const n=isMap(t)?getPlugin("MapSet").proxyMap_(t,e):isSet(t)?getPlugin("MapSet").proxySet_(t,e):createProxyProxy(t,e);return(e?e.scope_:getCurrentScope()).drafts_.push(n),n}function current(t){return isDraft(t)||die(10,t),currentImpl(t)}function currentImpl(t){if(!isDraftable(t)||isFrozen(t))return t;const e=t[DRAFT_STATE];let n;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=shallowCopy(t,e.scope_.immer_.useStrictShallowCopy_)}else n=shallowCopy(t,!0);return each(n,(o,l)=>{set$1(n,o,currentImpl(l))}),e&&(e.finalized_=!1),n}function enablePatches(){process.env.NODE_ENV!=="production"&&errors.push('Sets cannot have "replace" patches.',function(C){return"Unsupported patch operation: "+C},function(C){return"Cannot apply patch, path doesn't resolve: "+C},"Patching reserved attributes like __proto__, prototype and constructor is not allowed");const e="replace",n="add",o="remove";function l(C,E,A,I){switch(C.type_){case 0:case 2:return f(C,E,A,I);case 1:return d(C,E,A,I);case 3:return g(C,E,A,I)}}function d(C,E,A,I){let{base_:M,assigned_:j}=C,q=C.copy_;q.length<M.length&&([M,q]=[q,M],[A,I]=[I,A]);for(let z=0;z<M.length;z++)if(j[z]&&q[z]!==M[z]){const Q=E.concat([z]);A.push({op:e,path:Q,value:R(q[z])}),I.push({op:e,path:Q,value:R(M[z])})}for(let z=M.length;z<q.length;z++){const Q=E.concat([z]);A.push({op:n,path:Q,value:R(q[z])})}for(let z=q.length-1;M.length<=z;--z){const Q=E.concat([z]);I.push({op:o,path:Q})}}function f(C,E,A,I){const{base_:M,copy_:j}=C;each(C.assigned_,(q,z)=>{const Q=get$2(M,q),F=get$2(j,q),O=z?has$1(M,q)?e:n:o;if(Q===F&&O===e)return;const te=E.concat(q);A.push(O===o?{op:O,path:te}:{op:O,path:te,value:F}),I.push(O===n?{op:o,path:te}:O===o?{op:n,path:te,value:R(Q)}:{op:e,path:te,value:R(Q)})})}function g(C,E,A,I){let{base_:M,copy_:j}=C,q=0;M.forEach(z=>{if(!j.has(z)){const Q=E.concat([q]);A.push({op:o,path:Q,value:z}),I.unshift({op:n,path:Q,value:z})}q++}),q=0,j.forEach(z=>{if(!M.has(z)){const Q=E.concat([q]);A.push({op:n,path:Q,value:z}),I.unshift({op:o,path:Q,value:z})}q++})}function b(C,E,A,I){A.push({op:e,path:[],value:E===NOTHING?void 0:E}),I.push({op:e,path:[],value:C})}function _(C,E){return E.forEach(A=>{const{path:I,op:M}=A;let j=C;for(let F=0;F<I.length-1;F++){const O=getArchtype(j);let te=I[F];typeof te!="string"&&typeof te!="number"&&(te=""+te),(O===0||O===1)&&(te==="__proto__"||te==="constructor")&&die(19),typeof j=="function"&&te==="prototype"&&die(19),j=get$2(j,te),typeof j!="object"&&die(18,I.join("/"))}const q=getArchtype(j),z=S(A.value),Q=I[I.length-1];switch(M){case e:switch(q){case 2:return j.set(Q,z);case 3:die(16);default:return j[Q]=z}case n:switch(q){case 1:return Q==="-"?j.push(z):j.splice(Q,0,z);case 2:return j.set(Q,z);case 3:return j.add(z);default:return j[Q]=z}case o:switch(q){case 1:return j.splice(Q,1);case 2:return j.delete(Q);case 3:return j.delete(A.value);default:return delete j[Q]}default:die(17,M)}}),C}function S(C){if(!isDraftable(C))return C;if(Array.isArray(C))return C.map(S);if(isMap(C))return new Map(Array.from(C.entries()).map(([A,I])=>[A,S(I)]));if(isSet(C))return new Set(Array.from(C).map(S));const E=Object.create(getPrototypeOf(C));for(const A in C)E[A]=S(C[A]);return has$1(C,DRAFTABLE)&&(E[DRAFTABLE]=C[DRAFTABLE]),E}function R(C){return isDraft(C)?S(C):C}loadPlugin("Patches",{applyPatches_:_,generatePatches_:l,generateReplacementPatches_:b})}var immer=new Immer2,produce=immer.produce,produceWithPatches=immer.produceWithPatches.bind(immer);immer.setAutoFreeze.bind(immer),immer.setUseStrictShallowCopy.bind(immer);var applyPatches=immer.applyPatches.bind(immer);immer.createDraft.bind(immer),immer.finishDraft.bind(immer);var runIdentityFunctionCheck=(t,e,n)=>{if(e.length===1&&e[0]===n){let o=!1;try{const l={};t(l)===l&&(o=!0)}catch{}if(o){let l;try{throw new Error}catch(d){({stack:l}=d)}console.warn(`The result function returned its own inputs without modification. e.g
460
460
  \`createSelector([state => state.todos], todos => todos)\`
461
461
  This could lead to inefficient memoization and unnecessary re-renders.
462
462
  Ensure transformation logic is in the result function, and extraction logic is in the input selectors.`,{stack:l})}}},runInputStabilityCheck=(t,e,n)=>{const{memoize:o,memoizeOptions:l}=e,{inputSelectorResults:d,inputSelectorResultsCopy:f}=t,g=o(()=>({}),...l);if(!(g.apply(null,d)===g.apply(null,f))){let _;try{throw new Error}catch(S){({stack:_}=S)}console.warn(`An input selector returned a different result when passed same arguments.
@@ -1045,7 +1045,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An err
1045
1045
  * @license MIT
1046
1046
  */var isBuffer_1,hasRequiredIsBuffer;function requireIsBuffer(){if(hasRequiredIsBuffer)return isBuffer_1;hasRequiredIsBuffer=1,isBuffer_1=function(n){return n!=null&&(t(n)||e(n)||!!n._isBuffer)};function t(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function e(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&t(n.slice(0,0))}return isBuffer_1}var hasRequiredMd5;function requireMd5(){return hasRequiredMd5||(hasRequiredMd5=1,function(){var t=requireCrypt(),e=requireCharenc().utf8,n=requireIsBuffer(),o=requireCharenc().bin,l=function(d,f){d.constructor==String?f&&f.encoding==="binary"?d=o.stringToBytes(d):d=e.stringToBytes(d):n(d)?d=Array.prototype.slice.call(d,0):!Array.isArray(d)&&d.constructor!==Uint8Array&&(d=d.toString());for(var g=t.bytesToWords(d),b=d.length*8,_=1732584193,S=-271733879,R=-1732584194,C=271733878,E=0;E<g.length;E++)g[E]=(g[E]<<8|g[E]>>>24)&16711935|(g[E]<<24|g[E]>>>8)&4278255360;g[b>>>5]|=128<<b%32,g[(b+64>>>9<<4)+14]=b;for(var A=l._ff,I=l._gg,M=l._hh,j=l._ii,E=0;E<g.length;E+=16){var q=_,z=S,Q=R,F=C;_=A(_,S,R,C,g[E+0],7,-680876936),C=A(C,_,S,R,g[E+1],12,-389564586),R=A(R,C,_,S,g[E+2],17,606105819),S=A(S,R,C,_,g[E+3],22,-1044525330),_=A(_,S,R,C,g[E+4],7,-176418897),C=A(C,_,S,R,g[E+5],12,1200080426),R=A(R,C,_,S,g[E+6],17,-1473231341),S=A(S,R,C,_,g[E+7],22,-45705983),_=A(_,S,R,C,g[E+8],7,1770035416),C=A(C,_,S,R,g[E+9],12,-1958414417),R=A(R,C,_,S,g[E+10],17,-42063),S=A(S,R,C,_,g[E+11],22,-1990404162),_=A(_,S,R,C,g[E+12],7,1804603682),C=A(C,_,S,R,g[E+13],12,-40341101),R=A(R,C,_,S,g[E+14],17,-1502002290),S=A(S,R,C,_,g[E+15],22,1236535329),_=I(_,S,R,C,g[E+1],5,-165796510),C=I(C,_,S,R,g[E+6],9,-1069501632),R=I(R,C,_,S,g[E+11],14,643717713),S=I(S,R,C,_,g[E+0],20,-373897302),_=I(_,S,R,C,g[E+5],5,-701558691),C=I(C,_,S,R,g[E+10],9,38016083),R=I(R,C,_,S,g[E+15],14,-660478335),S=I(S,R,C,_,g[E+4],20,-405537848),_=I(_,S,R,C,g[E+9],5,568446438),C=I(C,_,S,R,g[E+14],9,-1019803690),R=I(R,C,_,S,g[E+3],14,-187363961),S=I(S,R,C,_,g[E+8],20,1163531501),_=I(_,S,R,C,g[E+13],5,-1444681467),C=I(C,_,S,R,g[E+2],9,-51403784),R=I(R,C,_,S,g[E+7],14,1735328473),S=I(S,R,C,_,g[E+12],20,-1926607734),_=M(_,S,R,C,g[E+5],4,-378558),C=M(C,_,S,R,g[E+8],11,-2022574463),R=M(R,C,_,S,g[E+11],16,1839030562),S=M(S,R,C,_,g[E+14],23,-35309556),_=M(_,S,R,C,g[E+1],4,-1530992060),C=M(C,_,S,R,g[E+4],11,1272893353),R=M(R,C,_,S,g[E+7],16,-155497632),S=M(S,R,C,_,g[E+10],23,-1094730640),_=M(_,S,R,C,g[E+13],4,681279174),C=M(C,_,S,R,g[E+0],11,-358537222),R=M(R,C,_,S,g[E+3],16,-722521979),S=M(S,R,C,_,g[E+6],23,76029189),_=M(_,S,R,C,g[E+9],4,-640364487),C=M(C,_,S,R,g[E+12],11,-421815835),R=M(R,C,_,S,g[E+15],16,530742520),S=M(S,R,C,_,g[E+2],23,-995338651),_=j(_,S,R,C,g[E+0],6,-198630844),C=j(C,_,S,R,g[E+7],10,1126891415),R=j(R,C,_,S,g[E+14],15,-1416354905),S=j(S,R,C,_,g[E+5],21,-57434055),_=j(_,S,R,C,g[E+12],6,1700485571),C=j(C,_,S,R,g[E+3],10,-1894986606),R=j(R,C,_,S,g[E+10],15,-1051523),S=j(S,R,C,_,g[E+1],21,-2054922799),_=j(_,S,R,C,g[E+8],6,1873313359),C=j(C,_,S,R,g[E+15],10,-30611744),R=j(R,C,_,S,g[E+6],15,-1560198380),S=j(S,R,C,_,g[E+13],21,1309151649),_=j(_,S,R,C,g[E+4],6,-145523070),C=j(C,_,S,R,g[E+11],10,-1120210379),R=j(R,C,_,S,g[E+2],15,718787259),S=j(S,R,C,_,g[E+9],21,-343485551),_=_+q>>>0,S=S+z>>>0,R=R+Q>>>0,C=C+F>>>0}return t.endian([_,S,R,C])};l._ff=function(d,f,g,b,_,S,R){var C=d+(f&g|~f&b)+(_>>>0)+R;return(C<<S|C>>>32-S)+f},l._gg=function(d,f,g,b,_,S,R){var C=d+(f&b|g&~b)+(_>>>0)+R;return(C<<S|C>>>32-S)+f},l._hh=function(d,f,g,b,_,S,R){var C=d+(f^g^b)+(_>>>0)+R;return(C<<S|C>>>32-S)+f},l._ii=function(d,f,g,b,_,S,R){var C=d+(g^(f|~b))+(_>>>0)+R;return(C<<S|C>>>32-S)+f},l._blocksize=16,l._digestsize=16,md5$1.exports=function(d,f){if(d==null)throw new Error("Illegal argument "+d);var g=t.wordsToBytes(l(d,f));return f&&f.asBytes?g:f&&f.asString?o.bytesToString(g):t.bytesToHex(g)}}()),md5$1.exports}var md5Exports=requireMd5();const md5=getDefaultExportFromCjs$1(md5Exports),constructFromSymbol=Symbol.for("constructDateFrom");function constructFrom(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&constructFromSymbol in t?t[constructFromSymbol](e):t instanceof Date?new t.constructor(e):new Date(e)}function toDate(t,e){return constructFrom(t,t)}function addDays(t,e,n){const o=toDate(t);return isNaN(e)?constructFrom(t,NaN):(o.setDate(o.getDate()+e),o)}function normalizeDates(t,...e){const n=constructFrom.bind(null,e.find(o=>typeof o=="object"));return e.map(n)}function startOfDay(t,e){const n=toDate(t);return n.setHours(0,0,0,0),n}function constructNow(t){return constructFrom(t,Date.now())}function isSameDay(t,e,n){const[o,l]=normalizeDates(n==null?void 0:n.in,t,e);return+startOfDay(o)==+startOfDay(l)}function isToday(t,e){return isSameDay(constructFrom(t,t),constructNow(t))}function subDays(t,e,n){return addDays(t,-1)}function isYesterday(t,e){return isSameDay(constructFrom(t,t),subDays(constructNow(t)))}var lib$3={},htmlToDom={},domparser={},utilities$2={},lib$2={},lib$1={},hasRequiredLib$3;function requireLib$3(){return hasRequiredLib$3||(hasRequiredLib$3=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Doctype=t.CDATA=t.Tag=t.Style=t.Script=t.Comment=t.Directive=t.Text=t.Root=t.isTag=t.ElementType=void 0;var e;(function(o){o.Root="root",o.Text="text",o.Directive="directive",o.Comment="comment",o.Script="script",o.Style="style",o.Tag="tag",o.CDATA="cdata",o.Doctype="doctype"})(e=t.ElementType||(t.ElementType={}));function n(o){return o.type===e.Tag||o.type===e.Script||o.type===e.Style}t.isTag=n,t.Root=e.Root,t.Text=e.Text,t.Directive=e.Directive,t.Comment=e.Comment,t.Script=e.Script,t.Style=e.Style,t.Tag=e.Tag,t.CDATA=e.CDATA,t.Doctype=e.Doctype}(lib$1)),lib$1}var node={},hasRequiredNode;function requireNode(){if(hasRequiredNode)return node;hasRequiredNode=1;var t=node&&node.__extends||function(){var F=function(O,te){return F=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ne,ae){ne.__proto__=ae}||function(ne,ae){for(var ge in ae)Object.prototype.hasOwnProperty.call(ae,ge)&&(ne[ge]=ae[ge])},F(O,te)};return function(O,te){if(typeof te!="function"&&te!==null)throw new TypeError("Class extends value "+String(te)+" is not a constructor or null");F(O,te);function ne(){this.constructor=O}O.prototype=te===null?Object.create(te):(ne.prototype=te.prototype,new ne)}}(),e=node&&node.__assign||function(){return e=Object.assign||function(F){for(var O,te=1,ne=arguments.length;te<ne;te++){O=arguments[te];for(var ae in O)Object.prototype.hasOwnProperty.call(O,ae)&&(F[ae]=O[ae])}return F},e.apply(this,arguments)};Object.defineProperty(node,"__esModule",{value:!0}),node.cloneNode=node.hasChildren=node.isDocument=node.isDirective=node.isComment=node.isText=node.isCDATA=node.isTag=node.Element=node.Document=node.CDATA=node.NodeWithChildren=node.ProcessingInstruction=node.Comment=node.Text=node.DataNode=node.Node=void 0;var n=requireLib$3(),o=function(){function F(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(F.prototype,"parentNode",{get:function(){return this.parent},set:function(O){this.parent=O},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"previousSibling",{get:function(){return this.prev},set:function(O){this.prev=O},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"nextSibling",{get:function(){return this.next},set:function(O){this.next=O},enumerable:!1,configurable:!0}),F.prototype.cloneNode=function(O){return O===void 0&&(O=!1),z(this,O)},F}();node.Node=o;var l=function(F){t(O,F);function O(te){var ne=F.call(this)||this;return ne.data=te,ne}return Object.defineProperty(O.prototype,"nodeValue",{get:function(){return this.data},set:function(te){this.data=te},enumerable:!1,configurable:!0}),O}(o);node.DataNode=l;var d=function(F){t(O,F);function O(){var te=F!==null&&F.apply(this,arguments)||this;return te.type=n.ElementType.Text,te}return Object.defineProperty(O.prototype,"nodeType",{get:function(){return 3},enumerable:!1,configurable:!0}),O}(l);node.Text=d;var f=function(F){t(O,F);function O(){var te=F!==null&&F.apply(this,arguments)||this;return te.type=n.ElementType.Comment,te}return Object.defineProperty(O.prototype,"nodeType",{get:function(){return 8},enumerable:!1,configurable:!0}),O}(l);node.Comment=f;var g=function(F){t(O,F);function O(te,ne){var ae=F.call(this,ne)||this;return ae.name=te,ae.type=n.ElementType.Directive,ae}return Object.defineProperty(O.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),O}(l);node.ProcessingInstruction=g;var b=function(F){t(O,F);function O(te){var ne=F.call(this)||this;return ne.children=te,ne}return Object.defineProperty(O.prototype,"firstChild",{get:function(){var te;return(te=this.children[0])!==null&&te!==void 0?te:null},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"lastChild",{get:function(){return this.children.length>0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"childNodes",{get:function(){return this.children},set:function(te){this.children=te},enumerable:!1,configurable:!0}),O}(o);node.NodeWithChildren=b;var _=function(F){t(O,F);function O(){var te=F!==null&&F.apply(this,arguments)||this;return te.type=n.ElementType.CDATA,te}return Object.defineProperty(O.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),O}(b);node.CDATA=_;var S=function(F){t(O,F);function O(){var te=F!==null&&F.apply(this,arguments)||this;return te.type=n.ElementType.Root,te}return Object.defineProperty(O.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),O}(b);node.Document=S;var R=function(F){t(O,F);function O(te,ne,ae,ge){ae===void 0&&(ae=[]),ge===void 0&&(ge=te==="script"?n.ElementType.Script:te==="style"?n.ElementType.Style:n.ElementType.Tag);var oe=F.call(this,ae)||this;return oe.name=te,oe.attribs=ne,oe.type=ge,oe}return Object.defineProperty(O.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"tagName",{get:function(){return this.name},set:function(te){this.name=te},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"attributes",{get:function(){var te=this;return Object.keys(this.attribs).map(function(ne){var ae,ge;return{name:ne,value:te.attribs[ne],namespace:(ae=te["x-attribsNamespace"])===null||ae===void 0?void 0:ae[ne],prefix:(ge=te["x-attribsPrefix"])===null||ge===void 0?void 0:ge[ne]}})},enumerable:!1,configurable:!0}),O}(b);node.Element=R;function C(F){return(0,n.isTag)(F)}node.isTag=C;function E(F){return F.type===n.ElementType.CDATA}node.isCDATA=E;function A(F){return F.type===n.ElementType.Text}node.isText=A;function I(F){return F.type===n.ElementType.Comment}node.isComment=I;function M(F){return F.type===n.ElementType.Directive}node.isDirective=M;function j(F){return F.type===n.ElementType.Root}node.isDocument=j;function q(F){return Object.prototype.hasOwnProperty.call(F,"children")}node.hasChildren=q;function z(F,O){O===void 0&&(O=!1);var te;if(A(F))te=new d(F.data);else if(I(F))te=new f(F.data);else if(C(F)){var ne=O?Q(F.children):[],ae=new R(F.name,e({},F.attribs),ne);ne.forEach(function(Ne){return Ne.parent=ae}),F.namespace!=null&&(ae.namespace=F.namespace),F["x-attribsNamespace"]&&(ae["x-attribsNamespace"]=e({},F["x-attribsNamespace"])),F["x-attribsPrefix"]&&(ae["x-attribsPrefix"]=e({},F["x-attribsPrefix"])),te=ae}else if(E(F)){var ne=O?Q(F.children):[],ge=new _(ne);ne.forEach(function(Ae){return Ae.parent=ge}),te=ge}else if(j(F)){var ne=O?Q(F.children):[],oe=new S(ne);ne.forEach(function(Ae){return Ae.parent=oe}),F["x-mode"]&&(oe["x-mode"]=F["x-mode"]),te=oe}else if(M(F)){var je=new g(F.name,F.data);F["x-name"]!=null&&(je["x-name"]=F["x-name"],je["x-publicId"]=F["x-publicId"],je["x-systemId"]=F["x-systemId"]),te=je}else throw new Error("Not implemented yet: ".concat(F.type));return te.startIndex=F.startIndex,te.endIndex=F.endIndex,F.sourceCodeLocation!=null&&(te.sourceCodeLocation=F.sourceCodeLocation),te}node.cloneNode=z;function Q(F){for(var O=F.map(function(ne){return z(ne,!0)}),te=1;te<O.length;te++)O[te].prev=O[te-1],O[te-1].next=O[te];return O}return node}var hasRequiredLib$2;function requireLib$2(){return hasRequiredLib$2||(hasRequiredLib$2=1,function(t){var e=lib$2&&lib$2.__createBinding||(Object.create?function(g,b,_,S){S===void 0&&(S=_);var R=Object.getOwnPropertyDescriptor(b,_);(!R||("get"in R?!b.__esModule:R.writable||R.configurable))&&(R={enumerable:!0,get:function(){return b[_]}}),Object.defineProperty(g,S,R)}:function(g,b,_,S){S===void 0&&(S=_),g[S]=b[_]}),n=lib$2&&lib$2.__exportStar||function(g,b){for(var _ in g)_!=="default"&&!Object.prototype.hasOwnProperty.call(b,_)&&e(b,g,_)};Object.defineProperty(t,"__esModule",{value:!0}),t.DomHandler=void 0;var o=requireLib$3(),l=requireNode();n(requireNode(),t);var d={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},f=function(){function g(b,_,S){this.dom=[],this.root=new l.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof _=="function"&&(S=_,_=d),typeof b=="object"&&(_=b,b=void 0),this.callback=b??null,this.options=_??d,this.elementCB=S??null}return g.prototype.onparserinit=function(b){this.parser=b},g.prototype.onreset=function(){this.dom=[],this.root=new l.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null},g.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},g.prototype.onerror=function(b){this.handleCallback(b)},g.prototype.onclosetag=function(){this.lastNode=null;var b=this.tagStack.pop();this.options.withEndIndices&&(b.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(b)},g.prototype.onopentag=function(b,_){var S=this.options.xmlMode?o.ElementType.Tag:void 0,R=new l.Element(b,_,void 0,S);this.addNode(R),this.tagStack.push(R)},g.prototype.ontext=function(b){var _=this.lastNode;if(_&&_.type===o.ElementType.Text)_.data+=b,this.options.withEndIndices&&(_.endIndex=this.parser.endIndex);else{var S=new l.Text(b);this.addNode(S),this.lastNode=S}},g.prototype.oncomment=function(b){if(this.lastNode&&this.lastNode.type===o.ElementType.Comment){this.lastNode.data+=b;return}var _=new l.Comment(b);this.addNode(_),this.lastNode=_},g.prototype.oncommentend=function(){this.lastNode=null},g.prototype.oncdatastart=function(){var b=new l.Text(""),_=new l.CDATA([b]);this.addNode(_),b.parent=_,this.lastNode=b},g.prototype.oncdataend=function(){this.lastNode=null},g.prototype.onprocessinginstruction=function(b,_){var S=new l.ProcessingInstruction(b,_);this.addNode(S)},g.prototype.handleCallback=function(b){if(typeof this.callback=="function")this.callback(b,this.dom);else if(b)throw b},g.prototype.addNode=function(b){var _=this.tagStack[this.tagStack.length-1],S=_.children[_.children.length-1];this.options.withStartIndices&&(b.startIndex=this.parser.startIndex),this.options.withEndIndices&&(b.endIndex=this.parser.endIndex),_.children.push(b),S&&(b.prev=S,S.next=b),b.parent=_,this.lastNode=null},g}();t.DomHandler=f,t.default=f}(lib$2)),lib$2}var constants={},hasRequiredConstants;function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CARRIAGE_RETURN_PLACEHOLDER_REGEX=t.CARRIAGE_RETURN_PLACEHOLDER=t.CARRIAGE_RETURN_REGEX=t.CARRIAGE_RETURN=t.CASE_SENSITIVE_TAG_NAMES_MAP=t.CASE_SENSITIVE_TAG_NAMES=void 0,t.CASE_SENSITIVE_TAG_NAMES=["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"],t.CASE_SENSITIVE_TAG_NAMES_MAP=t.CASE_SENSITIVE_TAG_NAMES.reduce(function(e,n){return e[n.toLowerCase()]=n,e},{}),t.CARRIAGE_RETURN="\r",t.CARRIAGE_RETURN_REGEX=new RegExp(t.CARRIAGE_RETURN,"g"),t.CARRIAGE_RETURN_PLACEHOLDER="__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_".concat(Date.now(),"__"),t.CARRIAGE_RETURN_PLACEHOLDER_REGEX=new RegExp(t.CARRIAGE_RETURN_PLACEHOLDER,"g")}(constants)),constants}var hasRequiredUtilities$2;function requireUtilities$2(){if(hasRequiredUtilities$2)return utilities$2;hasRequiredUtilities$2=1,Object.defineProperty(utilities$2,"__esModule",{value:!0}),utilities$2.formatAttributes=o,utilities$2.escapeSpecialCharacters=d,utilities$2.revertEscapedCharacters=f,utilities$2.formatDOM=g;var t=requireLib$2(),e=requireConstants();function n(b){return e.CASE_SENSITIVE_TAG_NAMES_MAP[b]}function o(b){for(var _={},S=0,R=b.length;S<R;S++){var C=b[S];_[C.name]=C.value}return _}function l(b){b=b.toLowerCase();var _=n(b);return _||b}function d(b){return b.replace(e.CARRIAGE_RETURN_REGEX,e.CARRIAGE_RETURN_PLACEHOLDER)}function f(b){return b.replace(e.CARRIAGE_RETURN_PLACEHOLDER_REGEX,e.CARRIAGE_RETURN)}function g(b,_,S){_===void 0&&(_=null);for(var R=[],C,E=0,A=b.length;E<A;E++){var I=b[E];switch(I.nodeType){case 1:{var M=l(I.nodeName);C=new t.Element(M,o(I.attributes)),C.children=g(M==="template"?I.content.childNodes:I.childNodes,C);break}case 3:C=new t.Text(f(I.nodeValue));break;case 8:C=new t.Comment(I.nodeValue);break;default:continue}var j=R[E-1]||null;j&&(j.next=C),C.parent=_,C.prev=j,C.next=null,R.push(C)}return S&&(C=new t.ProcessingInstruction(S.substring(0,S.indexOf(" ")).toLowerCase(),S),C.next=R[0]||null,C.parent=_,R.unshift(C),R[1]&&(R[1].prev=R[0])),R}return utilities$2}var hasRequiredDomparser;function requireDomparser(){if(hasRequiredDomparser)return domparser;hasRequiredDomparser=1,Object.defineProperty(domparser,"__esModule",{value:!0}),domparser.default=I;var t=requireUtilities$2(),e="html",n="head",o="body",l=/<([a-zA-Z]+[0-9]?)/,d=/<head[^]*>/i,f=/<body[^]*>/i,g=function(M,j){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},b=function(M,j){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},_=typeof window=="object"&&window.DOMParser;if(typeof _=="function"){var S=new _,R="text/html";b=function(M,j){return j&&(M="<".concat(j,">").concat(M,"</").concat(j,">")),S.parseFromString(M,R)},g=b}if(typeof document=="object"&&document.implementation){var C=document.implementation.createHTMLDocument();g=function(M,j){if(j){var q=C.documentElement.querySelector(j);return q&&(q.innerHTML=M),C}return C.documentElement.innerHTML=M,C}}var E=typeof document=="object"&&document.createElement("template"),A;E&&E.content&&(A=function(M){return E.innerHTML=M,E.content.childNodes});function I(M){var j,q;M=(0,t.escapeSpecialCharacters)(M);var z=M.match(l),Q=z&&z[1]?z[1].toLowerCase():"";switch(Q){case e:{var F=b(M);if(!d.test(M)){var O=F.querySelector(n);(j=O==null?void 0:O.parentNode)===null||j===void 0||j.removeChild(O)}if(!f.test(M)){var O=F.querySelector(o);(q=O==null?void 0:O.parentNode)===null||q===void 0||q.removeChild(O)}return F.querySelectorAll(e)}case n:case o:{var te=g(M).querySelectorAll(Q);return f.test(M)&&d.test(M)?te[0].parentNode.childNodes:te}default:{if(A)return A(M);var O=g(M,o).querySelector(o);return O.childNodes}}}return domparser}var hasRequiredHtmlToDom;function requireHtmlToDom(){if(hasRequiredHtmlToDom)return htmlToDom;hasRequiredHtmlToDom=1;var t=htmlToDom&&htmlToDom.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(htmlToDom,"__esModule",{value:!0}),htmlToDom.default=l;var e=t(requireDomparser()),n=requireUtilities$2(),o=/<(![a-zA-Z\s]+)>/;function l(d){if(typeof d!="string")throw new TypeError("First argument must be a string");if(!d)return[];var f=d.match(o),g=f?f[1]:void 0;return(0,n.formatDOM)((0,e.default)(d),null,g)}return htmlToDom}var attributesToProps={},lib={},possibleStandardNamesOptimized={},hasRequiredPossibleStandardNamesOptimized;function requirePossibleStandardNamesOptimized(){if(hasRequiredPossibleStandardNamesOptimized)return possibleStandardNamesOptimized;hasRequiredPossibleStandardNamesOptimized=1;var t=0;possibleStandardNamesOptimized.SAME=t;var e=1;return possibleStandardNamesOptimized.CAMELCASE=e,possibleStandardNamesOptimized.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1},possibleStandardNamesOptimized}var hasRequiredLib$1;function requireLib$1(){if(hasRequiredLib$1)return lib;hasRequiredLib$1=1;const t=0,e=1,n=2,o=3,l=4,d=5,f=6;function g(F){return _.hasOwnProperty(F)?_[F]:null}function b(F,O,te,ne,ae,ge,oe){this.acceptsBooleans=O===n||O===o||O===l,this.attributeName=ne,this.attributeNamespace=ae,this.mustUseProperty=te,this.propertyName=F,this.type=O,this.sanitizeURL=ge,this.removeEmptyString=oe}const _={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(F=>{_[F]=new b(F,t,!1,F,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([F,O])=>{_[F]=new b(F,e,!1,O,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(F=>{_[F]=new b(F,n,!1,F.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(F=>{_[F]=new b(F,n,!1,F,null,!1,!1)}),["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach(F=>{_[F]=new b(F,o,!1,F.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(F=>{_[F]=new b(F,o,!0,F,null,!1,!1)}),["capture","download"].forEach(F=>{_[F]=new b(F,l,!1,F,null,!1,!1)}),["cols","rows","size","span"].forEach(F=>{_[F]=new b(F,f,!1,F,null,!1,!1)}),["rowSpan","start"].forEach(F=>{_[F]=new b(F,d,!1,F.toLowerCase(),null,!1,!1)});const R=/[\-\:]([a-z])/g,C=F=>F[1].toUpperCase();["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach(F=>{const O=F.replace(R,C);_[O]=new b(O,e,!1,F,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(F=>{const O=F.replace(R,C);_[O]=new b(O,e,!1,F,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(F=>{const O=F.replace(R,C);_[O]=new b(O,e,!1,F,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(F=>{_[F]=new b(F,e,!1,F.toLowerCase(),null,!1,!1)});const E="xlinkHref";_[E]=new b("xlinkHref",e,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(F=>{_[F]=new b(F,e,!1,F.toLowerCase(),null,!0,!0)});const{CAMELCASE:A,SAME:I,possibleStandardNames:M}=requirePossibleStandardNamesOptimized(),q=":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"+"\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",z=RegExp.prototype.test.bind(new RegExp("^(data|aria)-["+q+"]*$")),Q=Object.keys(M).reduce((F,O)=>{const te=M[O];return te===I?F[O]=O:te===A?F[O.toLowerCase()]=O:F[O]=te,F},{});return lib.BOOLEAN=o,lib.BOOLEANISH_STRING=n,lib.NUMERIC=d,lib.OVERLOADED_BOOLEAN=l,lib.POSITIVE_NUMERIC=f,lib.RESERVED=t,lib.STRING=e,lib.getPropertyInfo=g,lib.isCustomAttribute=z,lib.possibleStandardNames=Q,lib}var utilities$1={},cjs$1={},inlineStyleParser,hasRequiredInlineStyleParser;function requireInlineStyleParser(){if(hasRequiredInlineStyleParser)return inlineStyleParser;hasRequiredInlineStyleParser=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,d=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,g=/^\s+|\s+$/g,b=`
1047
1047
  `,_="/",S="*",R="",C="comment",E="declaration";inlineStyleParser=function(I,M){if(typeof I!="string")throw new TypeError("First argument must be a string");if(!I)return[];M=M||{};var j=1,q=1;function z(Ne){var Ae=Ne.match(e);Ae&&(j+=Ae.length);var $e=Ne.lastIndexOf(b);q=~$e?Ne.length-$e:q+Ne.length}function Q(){var Ne={line:j,column:q};return function(Ae){return Ae.position=new F(Ne),ne(),Ae}}function F(Ne){this.start=Ne,this.end={line:j,column:q},this.source=M.source}F.prototype.content=I;function O(Ne){var Ae=new Error(M.source+":"+j+":"+q+": "+Ne);if(Ae.reason=Ne,Ae.filename=M.source,Ae.line=j,Ae.column=q,Ae.source=I,!M.silent)throw Ae}function te(Ne){var Ae=Ne.exec(I);if(Ae){var $e=Ae[0];return z($e),I=I.slice($e.length),Ae}}function ne(){te(n)}function ae(Ne){var Ae;for(Ne=Ne||[];Ae=ge();)Ae!==!1&&Ne.push(Ae);return Ne}function ge(){var Ne=Q();if(!(_!=I.charAt(0)||S!=I.charAt(1))){for(var Ae=2;R!=I.charAt(Ae)&&(S!=I.charAt(Ae)||_!=I.charAt(Ae+1));)++Ae;if(Ae+=2,R===I.charAt(Ae-1))return O("End of comment missing");var $e=I.slice(2,Ae-2);return q+=2,z($e),I=I.slice(Ae),q+=2,Ne({type:C,comment:$e})}}function oe(){var Ne=Q(),Ae=te(o);if(Ae){if(ge(),!te(l))return O("property missing ':'");var $e=te(d),Fe=Ne({type:E,property:A(Ae[0].replace(t,R)),value:$e?A($e[0].replace(t,R)):R});return te(f),Fe}}function je(){var Ne=[];ae(Ne);for(var Ae;Ae=oe();)Ae!==!1&&(Ne.push(Ae),ae(Ne));return Ne}return ne(),je()};function A(I){return I?I.replace(g,R):R}return inlineStyleParser}var hasRequiredCjs$1;function requireCjs$1(){if(hasRequiredCjs$1)return cjs$1;hasRequiredCjs$1=1;var t=cjs$1&&cjs$1.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(cjs$1,"__esModule",{value:!0}),cjs$1.default=n;var e=t(requireInlineStyleParser());function n(o,l){var d=null;if(!o||typeof o!="string")return d;var f=(0,e.default)(o),g=typeof l=="function";return f.forEach(function(b){if(b.type==="declaration"){var _=b.property,S=b.value;g?l(_,S,b):S&&(d=d||{},d[_]=S)}}),d}return cjs$1}var utilities={},hasRequiredUtilities$1;function requireUtilities$1(){if(hasRequiredUtilities$1)return utilities;hasRequiredUtilities$1=1,Object.defineProperty(utilities,"__esModule",{value:!0}),utilities.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,d=function(_){return!_||n.test(_)||t.test(_)},f=function(_,S){return S.toUpperCase()},g=function(_,S){return"".concat(S,"-")},b=function(_,S){return S===void 0&&(S={}),d(_)?_:(_=_.toLowerCase(),S.reactCompat?_=_.replace(l,g):_=_.replace(o,g),_.replace(e,f))};return utilities.camelCase=b,utilities}var cjs,hasRequiredCjs;function requireCjs(){if(hasRequiredCjs)return cjs;hasRequiredCjs=1;var t=cjs&&cjs.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},e=t(requireCjs$1()),n=requireUtilities$1();function o(l,d){var f={};return!l||typeof l!="string"||(0,e.default)(l,function(g,b){g&&b&&(f[(0,n.camelCase)(g,d)]=b)}),f}return o.default=o,cjs=o,cjs}var hasRequiredUtilities;function requireUtilities(){return hasRequiredUtilities||(hasRequiredUtilities=1,function(t){var e=utilities$1&&utilities$1.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(t,"__esModule",{value:!0}),t.returnFirstArg=t.canTextBeChildOfNode=t.ELEMENTS_WITH_NO_TEXT_CHILDREN=t.PRESERVE_CUSTOM_ATTRIBUTES=void 0,t.isCustomComponent=d,t.setStyleProp=g;var n=React,o=e(requireCjs()),l=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function d(S,R){return S.includes("-")?!l.has(S):!!(R&&typeof R.is=="string")}var f={reactCompat:!0};function g(S,R){if(typeof S=="string"){if(!S.trim()){R.style={};return}try{R.style=(0,o.default)(S,f)}catch{R.style={}}}}t.PRESERVE_CUSTOM_ATTRIBUTES=Number(n.version.split(".")[0])>=16,t.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var b=function(S){return!t.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(S.name)};t.canTextBeChildOfNode=b;var _=function(S){return S};t.returnFirstArg=_}(utilities$1)),utilities$1}var hasRequiredAttributesToProps;function requireAttributesToProps(){if(hasRequiredAttributesToProps)return attributesToProps;hasRequiredAttributesToProps=1,Object.defineProperty(attributesToProps,"__esModule",{value:!0}),attributesToProps.default=d;var t=requireLib$1(),e=requireUtilities(),n=["checked","value"],o=["input","select","textarea"],l={reset:!0,submit:!0};function d(g,b){g===void 0&&(g={});var _={},S=!!(g.type&&l[g.type]);for(var R in g){var C=g[R];if((0,t.isCustomAttribute)(R)){_[R]=C;continue}var E=R.toLowerCase(),A=f(E);if(A){var I=(0,t.getPropertyInfo)(A);switch(n.includes(A)&&o.includes(b)&&!S&&(A=f("default"+E)),_[A]=C,I&&I.type){case t.BOOLEAN:_[A]=!0;break;case t.OVERLOADED_BOOLEAN:C===""&&(_[A]=!0);break}continue}e.PRESERVE_CUSTOM_ATTRIBUTES&&(_[R]=C)}return(0,e.setStyleProp)(g.style,_),_}function f(g){return t.possibleStandardNames[g]}return attributesToProps}var domToReact={},hasRequiredDomToReact;function requireDomToReact(){if(hasRequiredDomToReact)return domToReact;hasRequiredDomToReact=1;var t=domToReact&&domToReact.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(domToReact,"__esModule",{value:!0}),domToReact.default=d;var e=React,n=t(requireAttributesToProps()),o=requireUtilities(),l={cloneElement:e.cloneElement,createElement:e.createElement,isValidElement:e.isValidElement};function d(g,b){b===void 0&&(b={});for(var _=[],S=typeof b.replace=="function",R=b.transform||o.returnFirstArg,C=b.library||l,E=C.cloneElement,A=C.createElement,I=C.isValidElement,M=g.length,j=0;j<M;j++){var q=g[j];if(S){var z=b.replace(q,j);if(I(z)){M>1&&(z=E(z,{key:z.key||j})),_.push(R(z,q,j));continue}}if(q.type==="text"){var Q=!q.data.trim().length;if(Q&&q.parent&&!(0,o.canTextBeChildOfNode)(q.parent)||b.trim&&Q)continue;_.push(R(q.data,q,j));continue}var F=q,O={};f(F)?((0,o.setStyleProp)(F.attribs.style,F.attribs),O=F.attribs):F.attribs&&(O=(0,n.default)(F.attribs,F.name));var te=void 0;switch(q.type){case"script":case"style":q.children[0]&&(O.dangerouslySetInnerHTML={__html:q.children[0].data});break;case"tag":q.name==="textarea"&&q.children[0]?O.defaultValue=q.children[0].data:q.children&&q.children.length&&(te=d(q.children,b));break;default:continue}M>1&&(O.key=j),_.push(R(A(q.name,O,te),q,j))}return _.length===1?_[0]:_}function f(g){return o.PRESERVE_CUSTOM_ATTRIBUTES&&g.type==="tag"&&(0,o.isCustomComponent)(g.name,g.attribs)}return domToReact}var hasRequiredLib;function requireLib(){return hasRequiredLib||(hasRequiredLib=1,function(t){var e=lib$3&&lib$3.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(t,"__esModule",{value:!0}),t.htmlToDOM=t.domToReact=t.attributesToProps=t.Text=t.ProcessingInstruction=t.Element=t.Comment=void 0,t.default=g;var n=e(requireHtmlToDom());t.htmlToDOM=n.default;var o=e(requireAttributesToProps());t.attributesToProps=o.default;var l=e(requireDomToReact());t.domToReact=l.default;var d=requireLib$2();Object.defineProperty(t,"Comment",{enumerable:!0,get:function(){return d.Comment}}),Object.defineProperty(t,"Element",{enumerable:!0,get:function(){return d.Element}}),Object.defineProperty(t,"ProcessingInstruction",{enumerable:!0,get:function(){return d.ProcessingInstruction}}),Object.defineProperty(t,"Text",{enumerable:!0,get:function(){return d.Text}});var f={lowerCaseAttributeNames:!1};function g(b,_){if(typeof b!="string")throw new TypeError("First argument must be a string");return b?(0,l.default)((0,n.default)(b,(_==null?void 0:_.htmlparser2)||f),_):[]}}(lib$3)),lib$3}var libExports=requireLib();const HTMLReactParser=getDefaultExportFromCjs$1(libExports),parser=HTMLReactParser.default||HTMLReactParser;function SkeletonMessage({botStatus:t}){return jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[jsxRuntime.jsx("div",{className:"h-8 w-8 mt-1 rounded-full bg-gray-300 animate-pulse flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsxs("p",{className:"mb-1",children:["Assistant",jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground mt-1 ml-3",children:new Date().toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})})]}),jsxRuntime.jsx("div",{className:"rounded-md p-3 break-words bg-white border rounded-tl-none",children:jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-150"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-300"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:t})]})})]})]})}const toHTML=t=>t.split(`
1048
- `).map(e=>jsxRuntime.jsx("p",{children:e}));function ChatMessages({messages:t,currentUserId:e,botStatus:n,isAssistantChat:o}){return jsxRuntime.jsxs("div",{children:[t.map(l=>{const d=l.fromPartnerID===e;return jsxRuntime.jsxs("div",{className:cn("flex items-start gap-2 mt-2 mb-2",d&&"flex-row-reverse"),children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 mt-1",children:jsxRuntime.jsx(AvatarImage,{src:`https://api.dicebear.com/9.x/thumbs/svg?seed=${md5(l.senderName+l.fromPartnerID)}&flip=${d}`})}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsxs("p",{className:"mb-1",children:[l.senderName,jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground mt-1 ml-3",children:(()=>{const f=new Date(l.timestamp);return isToday(f)?f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}):isYesterday(f)?`Yesterday, ${f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`:`${f.toLocaleDateString([],{month:"short",day:"numeric"})} ${f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`})()})]}),jsxRuntime.jsx("div",{className:cn("rounded-md p-3 break-words [&_li]:ml-6 [&_li]:list-disc [&_h1]:text-lg [&_h1]:font-bold [&_h1]:mt-4 [&_h2]:font-bold [&_h2]:mt-4 [&_h3]:mt-4 ",d?"bg-primary text-white rounded-tr-none":"bg-white border rounded-tl-none"),children:l.fromPartnerID===ASSISTANT_ID?parser(l.content):toHTML(l.content)})]})]},l.id)}),n!==""&&jsxRuntime.jsx(SkeletonMessage,{botStatus:n}),t.length===0&&!o&&jsxRuntime.jsx("div",{className:"text-center text-muted-foreground py-8",children:"No messages yet"}),t.length===0&&n===""&&o&&jsxRuntime.jsxs("div",{className:"text-center py-8",children:[jsxRuntime.jsx("p",{children:"The Randmar Assistant is ready to help you. Ask anything about products, orders, carts, shipments and tracking numbers."}),jsxRuntime.jsx("p",{children:jsxRuntime.jsx("strong",{children:'Try it now, type "my open orders"!'})})]})]})}var SWITCH_NAME="Switch",[createSwitchContext,createSwitchScope]=createContextScope(SWITCH_NAME),[SwitchProvider,useSwitchContext]=createSwitchContext(SWITCH_NAME),Switch$1=React__namespace.forwardRef((t,e)=>{const{__scopeSwitch:n,name:o,checked:l,defaultChecked:d,required:f,disabled:g,value:b="on",onCheckedChange:_,form:S,...R}=t,[C,E]=React__namespace.useState(null),A=useComposedRefs(e,z=>E(z)),I=React__namespace.useRef(!1),M=C?S||!!C.closest("form"):!0,[j,q]=useControllableState({prop:l,defaultProp:d??!1,onChange:_,caller:SWITCH_NAME});return jsxRuntime.jsxs(SwitchProvider,{scope:n,checked:j,disabled:g,children:[jsxRuntime.jsx(Primitive.button,{type:"button",role:"switch","aria-checked":j,"aria-required":f,"data-state":getState$2(j),"data-disabled":g?"":void 0,disabled:g,value:b,...R,ref:A,onClick:composeEventHandlers(t.onClick,z=>{q(Q=>!Q),M&&(I.current=z.isPropagationStopped(),I.current||z.stopPropagation())})}),M&&jsxRuntime.jsx(SwitchBubbleInput,{control:C,bubbles:!I.current,name:o,value:b,checked:j,required:f,disabled:g,form:S,style:{transform:"translateX(-100%)"}})]})});Switch$1.displayName=SWITCH_NAME;var THUMB_NAME="SwitchThumb",SwitchThumb=React__namespace.forwardRef((t,e)=>{const{__scopeSwitch:n,...o}=t,l=useSwitchContext(THUMB_NAME,n);return jsxRuntime.jsx(Primitive.span,{"data-state":getState$2(l.checked),"data-disabled":l.disabled?"":void 0,...o,ref:e})});SwitchThumb.displayName=THUMB_NAME;var BUBBLE_INPUT_NAME$2="SwitchBubbleInput",SwitchBubbleInput=React__namespace.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:o=!0,...l},d)=>{const f=React__namespace.useRef(null),g=useComposedRefs(f,d),b=usePrevious(n),_=useSize(e);return React__namespace.useEffect(()=>{const S=f.current;if(!S)return;const R=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(R,"checked").set;if(b!==n&&E){const A=new Event("click",{bubbles:o});E.call(S,n),S.dispatchEvent(A)}},[b,n,o]),jsxRuntime.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...l,tabIndex:-1,ref:g,style:{...l.style,..._,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});SwitchBubbleInput.displayName=BUBBLE_INPUT_NAME$2;function getState$2(t){return t?"checked":"unchecked"}var Root$1=Switch$1,Thumb=SwitchThumb;const Switch=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Root$1,{className:cn("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:jsxRuntime.jsx(Thumb,{className:cn("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Switch.displayName=Root$1.displayName;const DebugMessageDisplay=({debugMessages:t})=>{const[e,n]=React.useState({}),o=l=>{n(d=>({...d,[l]:!d[l]}))};return jsxRuntime.jsx("div",{children:t.map((l,d)=>{if(typeof l=="string")return jsxRuntime.jsx("p",{className:"text-slate-600",children:l},d);{const f=e[d];return jsxRuntime.jsxs("div",{className:"cursor-pointer",onClick:()=>o(d),children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("p",{className:"text-slate-600 mr-2",children:l[0]}),jsxRuntime.jsx("span",{className:"text-slate-500 text-xs",children:f?"▲":"▼"})]}),f&&jsxRuntime.jsx("p",{className:"text-slate-400 pl-4",children:l[1]})]},d)}})})},ASSISTANT_ID="RandmarAIChatAssistant",ChatLayout=React.forwardRef(({userId:t,userName:e,apiKey:n,inputRef:o},l)=>{const{data:d,refetch:f}=useGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationsQuery({routeApplicationId:t}),[g]=useLazyGetV4PartnerByApplicationIdAccountQuery(),[b]=usePostV4PartnerByApplicationIdAccountDebugFeedbackMutation(),[_,{isLoading:S}]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),[R,C]=React.useState(!1),E=React.useRef(null),[A]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),[I]=useLazyGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationAndConversationIdMessagesQuery(),{handleSubmitToBot:M,botMessages:j,clearBotMessages:q,botReady:z,debugMessages:Q,botStatus:F,reset:O}=useAIAssistant({userId:t,apiKey:n,smartAndSlow:R});React.useEffect(()=>{if(!d)return;const ut={partner1:t,partner2:ASSISTANT_ID,name:"Randmar Assistant",unread:0,pending:!1,historyFetched:!0,messages:[],conversationID:-1},Mt=d.map(Ut=>{var yt;return{partner1:Ut.Participant1,partner2:Ut.Participant2,name:((yt=Ut.Participant)==null?void 0:yt.PublicName)??"missing public name",unread:0,pending:Ut.Status!="Approved",historyFetched:!1,messages:[],conversationID:Ut.ConversationId}});setTimeout(()=>{var Ut;return(Ut=it.current)==null?void 0:Ut.focus()},50),Fe([ut,...Mt])},[d]);const[te,ne]=React.useState("approved"),[ae,ge]=React.useState([t,ASSISTANT_ID]),[oe,je]=React.useState(""),[Ne,Ae]=React.useState(null),[$e,Fe]=React.useState([]),[ze,Ve]=React.useState(""),[Be,qe]=React.useState(null),[Ke,He]=React.useState([]),[,Xe]=React.useState(0),tt=React.useRef(null),Ye=React.useRef(null),[et,Ze]=React.useState(null),[at,rt]=React.useState([]),it=o||Ye,st=React.useRef(null),{toast:Ue}=useToast(),Rt=$e.filter(ut=>{const Mt=ut.name.toLowerCase().includes(ze.toLowerCase());return te==="approved"?Mt&&!ut.pending:te==="pending"?Mt&&ut.pending:Mt});React.useEffect(()=>{var ut;et!==null&&(Ue({title:"File attached",description:"Add your instruction before sending.",variant:"success"}),(ut=it.current)==null||ut.focus())},[et]),React.useEffect(()=>{j.length!==0&&(j.forEach(ut=>{if(!ut)return;if(ut.isComponent){He(Ut=>[...Ut,ut.content]),Xe(0);return}const Mt={id:ut.timestamp.toString(),fromPartnerID:ASSISTANT_ID,toPartnerID:t,senderName:"Assistant",timestamp:ut.timestamp.getTime(),content:ut.content};Mt.content=marked(Mt.content,{async:!1}),Je(Mt)}),q())},[j]);function Je(ut){const Mt=[ut.fromPartnerID,ut.toPartnerID];Mt.sort(),Fe(Ut=>{let yt=!1;const nr=Ut.map(er=>er.partner1!==Mt[0]||er.partner2!==Mt[1]||er.messages.findIndex(lr=>lr.id==ut.id)!==-1?er:(yt=!0,{...er,unread:er.unread+1,messages:[...er.messages,ut]}));return yt&&Ae([Mt[0],Mt[1]]),nr})}React.useEffect(()=>{const ut=new HubConnectionBuilder().withUrl("https://api.randmar.io/hub",{accessTokenFactory:()=>localStorage.getItem("access_token"),headers:{"X-Impersonated-Id":t}}).configureLogging(LogLevel.Information).withAutomaticReconnect().withHubProtocol(new JsonHubProtocol).build();return ut.on("ReceiveMessage",Je),ut.start().catch(Mt=>console.error("Error connecting to SignalR hub:",Mt)),qe(ut),()=>{ut&&ut.stop()}},[t]),React.useEffect(()=>{(Ne==null?void 0:Ne[0])!==(ae==null?void 0:ae[0])||(Ne==null?void 0:Ne[1])!==(ae==null?void 0:ae[1])||(Fe(ut=>ut.map(Mt=>Mt.partner1===(ae==null?void 0:ae[0])&&Mt.partner2===(ae==null?void 0:ae[1])?{...Mt,unread:0}:Mt)),setTimeout(()=>{var ut;return(ut=tt.current)==null?void 0:ut.scrollIntoView({behavior:"smooth"})},50))},[Ne,ae]),React.useEffect(()=>{if(!ae)return;const ut=getActiveChatObject($e,ae);if(ut){if(ut.historyFetched){ut.unread>0&&Fe(Mt=>Mt.map(Ut=>Ut.partner1===ae[0]&&Ut.partner2===ae[1]?{...Ut,unread:0}:Ut)),setTimeout(()=>{var Mt;return(Mt=tt.current)==null?void 0:Mt.scrollIntoView({behavior:"smooth"})},50);return}I({routeApplicationId:t,conversationId:ut.conversationID}).unwrap().then(Mt=>{const Ut=Mt.map(yt=>({id:"history"+yt.MessageId,fromPartnerID:yt.SenderId,toPartnerID:yt.SenderId==ae[0]?ae[1]:ae[0],senderName:yt.SenderName??"missing name",timestamp:new Date(yt.SentDate+"Z").getTime(),content:yt.Content??"no content"}));Fe(yt=>yt.map(nr=>nr.partner1===ae[0]&&nr.partner2===ae[1]?{...nr,messages:Ut,historyFetched:!0}:nr))}).catch(Mt=>{console.error("Error fetching conversation messages:",Mt)})}},[$e,ae,I,t]),React.useEffect(()=>{var Mt;if(Xe(Ke.length),!ae)return;const ut=getActiveChatObject($e,ae);ut&&((Mt=it.current)==null||Mt.focus(),g({applicationId:ut.partner1===t?ut.partner2:ut.partner1}).then(Ut=>{Ut.data&&(He(yt=>[...yt,jsxRuntime.jsx("div",{className:"mt-2",children:jsxRuntime.jsx(PartnerCard,{account:Ut.data,action:jsxRuntime.jsx(jsxRuntime.Fragment,{}),withVoice:!1})})]),Xe(0))}))},[ae,t]);const mt=(ut,Mt,Ut)=>{const yt={id:crypto.randomUUID(),senderName:e,fromPartnerID:t,toPartnerID:Mt[0]===t?Mt[1]:Mt[0],content:ut+(et?` (${et==null?void 0:et.name} attached)`:""),timestamp:Date.now()};Fe(nr=>nr.map(er=>er.partner1===Mt[0]&&er.partner2===Mt[1]?{...er,messages:[...er.messages,yt]}:er)),Ae([Mt[0],Mt[1]]),yt.toPartnerID==ASSISTANT_ID?(M(yt.content,et??void 0),et&&rt(nr=>[...nr,et.name])):Ut.invoke("NewMessage",yt).catch(nr=>console.error("Error sending message:",nr)),je(""),Ze(null),st.current&&(st.current.value="")},$t=(ut,Mt)=>{if(!$e.length||!Be||!z)return!1;const Ut=$e.find(yt=>yt.conversationID===ut);return Ut?(Ut.pending&&setTimeout(()=>ne("pending"),300),ge([Ut.partner1,Ut.partner2]),Mt&&setTimeout(()=>mt(Mt,[Ut.partner1,Ut.partner2],Be),300),!0):!1};if(React.useImperativeHandle(l,()=>({setActiveChatAndSendMessage:$t})),!z)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("div",{className:"flex items-center justify-center p-8",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto mb-4"}),jsxRuntime.jsx("p",{children:"Loading API functions..."})]})})});const Dt=ut=>{var Ut;if(!isAssistantChat(ae))return;const Mt=(Ut=ut.clipboardData)==null?void 0:Ut.items;if(Mt){for(let yt=0;yt<Mt.length;yt++)if(Mt[yt].type.indexOf("image")!==-1){const nr=Mt[yt].getAsFile();if(nr){Ze(nr);return}}}},Ht=()=>{!oe.trim()||!ae||!Be||(Xe(Ke.length),mt(oe,ae,Be))},Vt=ut=>{ut.target.files&&ut.target.files[0]?Ze(ut.target.files[0]):Ze(null)},We=()=>{var ut;(ut=st.current)==null||ut.click()},nt=()=>{var ut;Ze(null),Ue({title:"File removed",description:"No file will be sent to the assistant.",variant:"secondary"}),(ut=it.current)==null||ut.focus()},Qe=()=>{const Mt={messages:$e.find(Ut=>Ut.partner1===ASSISTANT_ID||Ut.partner2===ASSISTANT_ID),debug:Q};b({applicationId:t,emailAddress:e,body:Mt})},dt=async()=>{E.current&&(E.current.disabled=!0),await A({routeApplicationId:t,partnerId:"2"}),await f()},pt=()=>{Fe(ut=>ut.map(Ut=>Ut.partner1!==ASSISTANT_ID&&Ut.partner2!==ASSISTANT_ID?Ut:{...Ut,messages:[]})),rt([]),O()},ft=()=>{ae&&_({routeApplicationId:t,partnerId:ae[0]==t?ae[1]:ae[0]}).then(()=>{ne("approved")})},ct=getActiveChatObject($e,ae),qt=$e.filter(ut=>ut.pending).length;return jsxRuntime.jsxs("div",{className:"flex h-[85vh] overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"w-[260px] p-4 pt-3 flex flex-col border-r",children:[jsxRuntime.jsx("div",{className:"p-4 font-semibold border-b",children:"Communications"}),$e.length>1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"p-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(Search,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),jsxRuntime.jsx(Input,{placeholder:"Search chats...",className:"pl-8 h-9",value:ze,onChange:ut=>Ve(ut.target.value)})]})}),jsxRuntime.jsx(Tabs,{value:te,onValueChange:ne,className:"w-full mb-1",children:jsxRuntime.jsxs(TabsList,{className:"grid grid-cols-6 h-9 mx-2",children:[jsxRuntime.jsx(TabsTrigger,{value:"approved",className:"text-xs col-span-3",children:"Approved"}),jsxRuntime.jsxs(TabsTrigger,{value:"pending",className:"text-xs col-span-3",children:["Pending ",qt>0&&`(${qt})`]})]})})]}),jsxRuntime.jsx("div",{className:"mt-1 mb-1",children:$e.findIndex(ut=>ut.partner1==="2"||ut.partner2==="2")<0?jsxRuntime.jsx(Button,{className:"w-full",ref:E,onClick:()=>dt(),children:"Chat with Randmar"},"b1"):jsxRuntime.jsx("a",{target:"_blank",href:`https://dashboard.randmar.io/${t}/ExploreManufacturers`,children:jsxRuntime.jsx(Button,{className:"w-full",children:"Explore manufacturers"},"b2")})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1",children:$e.length&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(ChatList,{userId:t,chats:Rt.filter(ut=>ut.partner1!=ASSISTANT_ID&&ut.partner2!=ASSISTANT_ID),activeChat:ct??null,onSelectChat:ge,assistantChat:$e.find(ut=>ut.partner1==ASSISTANT_ID||ut.partner2==ASSISTANT_ID)})})})]}),jsxRuntime.jsx("div",{className:"flex-3 flex flex-col",children:ae?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:ae[0]==ASSISTANT_ID||ae[1]==ASSISTANT_ID?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:jsxRuntime.jsx(Bot,{className:"text-primary fill-white min-h-full"})}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:"Randmar Assistant"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 ml-auto",children:[jsxRuntime.jsx(Switch,{id:"smartSwitch",disabled:!!F,checked:R,onCheckedChange:ut=>{pt(),setTimeout(()=>C(ut),20)}}),jsxRuntime.jsx(Label$2,{htmlFor:"smartSwitch",children:"Think harder"})]}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-1",onClick:()=>pt(),children:jsxRuntime.jsx(MessageCircleX,{className:"h-5 w-5"})}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-1",confirmationDialog:{title:"Report Issue",content:"This action will send a copy of your chat to Randmar. Send it?",onConfirm:()=>Qe()},children:jsxRuntime.jsx(MessageSquareShare,{className:"h-5 w-5"})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:[jsxRuntime.jsx(AvatarImage,{src:`https://api.randmar.io/v4/Partner/${ae[0]===t?ae[1]:ae[0]}/Account/Logo?height=72&width=72`,className:" object-contain "}),jsxRuntime.jsx(AvatarFallback,{children:jsxRuntime.jsx(Handshake,{className:"text-primary fill-white min-h-full"})})]}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:ct==null?void 0:ct.name}),jsxRuntime.jsx("div",{className:"flex items-center space-x-2 ml-auto",children:jsxRuntime.jsx("a",{href:`https://dashboard.randmar.io/${t}/Partner/${ae[0]===t?ae[1]:ae[0]}`,target:"_blank",children:jsxRuntime.jsx(Button,{children:"View Partner"})})})]})}),ct!=null&&ct.pending&&ct.partner1==t?jsxRuntime.jsx("p",{className:"mt-8 p-2 mx-auto",children:"This conversation is awaiting approval by the other party — please check back later."}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:[jsxRuntime.jsx(ChatMessages,{messages:(ct==null?void 0:ct.messages)??[],currentUserId:t,isAssistantChat:isAssistantChat(ae),botStatus:isAssistantChat(ae)?F:""}),jsxRuntime.jsx("div",{ref:tt})]}),jsxRuntime.jsxs("div",{className:"p-4 border-t flex",children:[(ct==null?void 0:ct.pending)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{disabled:S,onClick:()=>ft(),children:[jsxRuntime.jsx(Handshake,{}),"Accept Conversation Request"]}),jsxRuntime.jsxs(Button,{disabled:!0,className:"ml-2",children:[jsxRuntime.jsx(ThumbsDown,{}),"Block Partner"]})]}),jsxRuntime.jsx(Textarea,{ref:it,placeholder:"Type a message...",value:oe,onPaste:Dt,onChange:ut=>je(ut.target.value),onKeyDown:ut=>{ut.key!=="Enter"||ut.shiftKey||(ut.preventDefault(),Ht())},className:ct!=null&&ct.pending?"collapse":"flex-1 resize-none"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Button,{size:"icon",variant:"default",className:ct!=null&&ct.pending?"collapse":"ml-2 h-8 w-8",disabled:!!F||(ct==null?void 0:ct.pending),onClick:Ht,children:jsxRuntime.jsx(Send,{className:"h-6 w-6"})}),isAssistantChat(ae)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Input,{type:"file",onChange:Vt,className:"hidden",ref:st}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:We,className:ct!=null&&ct.pending?"collapse":"ml-2 h-8 w-8",disabled:F!==""||(ct==null?void 0:ct.pending)||!!et,children:jsxRuntime.jsx(Paperclip,{className:"h-5 w-5"})}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:nt,className:ct!=null&&ct.pending?"collapse":"ml-2 h-8 w-8",disabled:F!==""||(ct==null?void 0:ct.pending)||!et,children:jsxRuntime.jsx(Trash,{className:"h-5 w-5"})})]})]})]})]})]}):jsxRuntime.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Select a chat to start messaging"})}),jsxRuntime.jsx("div",{className:"w-[480px] flex flex-2 flex-col border-l",children:isAssistantChat(ae)?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Sources and System Info"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[et?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx(File,{})," ",et.name," (pending send...)"]})}):at.length?jsxRuntime.jsx(jsxRuntime.Fragment,{}):jsxRuntime.jsx("p",{children:"No files attached to this conversation yet."}),at.slice().reverse().map(ut=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx(File,{})," ",ut]})}))]})}),jsxRuntime.jsx(ScrollArea,{className:"flex-4 border-t pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx("div",{className:"space-y-2",children:jsxRuntime.jsx(DebugMessageDisplay,{debugMessages:Q})})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Partner Overview"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx(PartnerRelationshipPage,{applicationId:t,partnerId:((ae==null?void 0:ae[0])===t?ae[1]:ae==null?void 0:ae[0])??t,userEmail:e,shopifyHostName:void 0,isSuperAdmin:!1})})]})})]})});function getActiveChatObject(t,e){return t.find(n=>n.partner1==(e==null?void 0:e[0])&&n.partner2==(e==null?void 0:e[1]))}function isAssistantChat(t){return(t==null?void 0:t[0])==ASSISTANT_ID||(t==null?void 0:t[1])==ASSISTANT_ID}const alertVariants=cva("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",success:"border-green-500/50 bg-green-50 text-green-700 dark:border-green-500 dark:bg-green-950 dark:text-green-400 [&>svg]:text-green-500",warning:"border-yellow-500/50 bg-yellow-50 text-yellow-700 dark:border-yellow-500 dark:bg-yellow-950 dark:text-yellow-400 [&>svg]:text-yellow-500",info:"border-blue-500/50 bg-blue-50 text-blue-700 dark:border-blue-500 dark:bg-blue-950 dark:text-blue-400 [&>svg]:text-blue-500"}},defaultVariants:{variant:"default"}}),Alert=React__namespace.forwardRef(({className:t,variant:e,...n},o)=>jsxRuntime.jsx("div",{ref:o,role:"alert",className:cn(alertVariants({variant:e}),t),...n}));Alert.displayName="Alert";const AlertTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("h5",{ref:n,className:cn("mb-1 font-medium leading-none tracking-tight",t),...e}));AlertTitle.displayName="AlertTitle";const AlertDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("text-sm [&_p]:leading-relaxed",t),...e}));AlertDescription.displayName="AlertDescription";function QualificationBadge({qualification:t}){return!t.QualificationId||t.QualificationId==="Suspended"?null:t.QualificationId==="Do Not Sell"?jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"destructive",children:[jsxRuntime.jsx(X$1,{className:"h-3 w-3 mr-1"}),"Do Not Sell"]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})}):jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"info",className:t.DefaultOpportunityNumber?"pr-1":"",children:[jsxRuntime.jsx(BadgeCheck,{className:"h-3 w-3 mr-1"}),t.QualificationId,t.DefaultOpportunityNumber&&jsxRuntime.jsx(Badge,{variant:"secondary",size:"sm",className:"ml-1",children:t.DefaultOpportunityNumber})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})})}function ManufacturerCard({manufacturer:t,link:e,linkNewTab:n=!0,actions:o,mainAction:l,loading:d=!1}){var E,A,I;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(", "):"",_=((E=t.Tags)==null?void 0:E.split(",").map(M=>M.trim()).filter(Boolean))||[],S=M=>M===void 0?"n/a":new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:0,maximumFractionDigits:0}).format(M),C=(M=>!M||M.length===0?[]:[...M].sort((j,q)=>(j.Day||0)-(q.Day||0)).map(j=>({date:j.Day||0,amount:j.ExtendedPrice||0})))(t.SalesStatistics);return jsxRuntime.jsxs(Card,{className:"manufacturer-theme flex flex-col h-full",children:[jsxRuntime.jsx(reactRouterDom.Link,{to:e??"#",target:e&&n?"_blank":"_self",children:jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx(PartnerLogo,{id:t.ManufacturerId,width:48,height:48})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Manufacturer"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:f})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"}),t.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t.Name}),b&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:b})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:C.length>0&&jsxRuntime.jsx("div",{className:"h-16 w-24",children:jsxRuntime.jsx(AreaChart,{data:C,height:60,size:"mini"})})})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[(!!((A=t.Qualification)!=null&&A.QualificationId)&&((I=t.Qualification)==null?void 0:I.QualificationId)!=="Suspended"||!!t.OpenToWork||_.length>0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(QualificationBadge,{qualification:t.Qualification??{}}),!!t.OpenToWork&&jsxRuntime.jsxs(Badge,{variant:"success",children:[jsxRuntime.jsx(HardHat,{className:"h-3 w-3 mr-1"}),"Open To Work"]}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"}),_.map((M,j)=>jsxRuntime.jsx(Badge,{variant:"outline",children:M},j))]}),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:S(t.SalesData.SalesYearToDay)}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:S(t.SalesData.SalesLast3Months)}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:S(t.SalesData.SalesLast30Days)})]})]})}),(o||l)&&jsxRuntime.jsxs(CardFooter,{className:"flex pt-2 gap-2 justify-between mt-auto",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:o&&o}),l&&jsxRuntime.jsx("div",{children:l})]})]})}function ResellerCard({reseller:t,link:e,actions:n,loading:o=!1}){var b,_;const l=S=>S===void 0?"n/a":new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:0,maximumFractionDigits:0}).format(S);if(o||!t)return jsxRuntime.jsxs(Card,{className:"flex flex-col h-full",children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsx("div",{className:"flex",children:jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const d=t.ResellerId||"N/A",f=[t.City,t.Province,t.Country].filter(Boolean),g=f.length>0?f.join(", "):"Location not provided";return jsxRuntime.jsxs(Card,{className:"reseller-theme flex flex-col h-full",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx(PartnerLogo,{id:t.ResellerId,width:48,height:48})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Reseller"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:d})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"}),t.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t.Name}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:g})]})]}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"})]}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[!!((b=t.Qualification)!=null&&b.QualificationId)&&((_=t.Qualification)==null?void 0:_.QualificationId)!=="Suspended"&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:jsxRuntime.jsx(QualificationBadge,{qualification:t.Qualification??{}})}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${t.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${t.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:t.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})]}),(t==null?void 0:t.SalesData)&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:l(t==null?void 0:t.SalesData.SalesYearToDay)}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:l(t==null?void 0:t.SalesData.SalesLast3Months)}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:l(t==null?void 0:t.SalesData.SalesLast30Days)})]})]})}),(n||e)&&jsxRuntime.jsxs(CardFooter,{className:`flex pt-2 gap-2 mt-auto ${n?"justify-between":"justify-end"}`,children:[n&&n,e&&jsxRuntime.jsx(Button,{className:"flex items-center gap-1",asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:e,target:"_blank",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Reseller"]})})]})]})}const Table=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{className:"relative w-full overflow-auto",children:jsxRuntime.jsx("table",{ref:n,className:cn("w-full caption-bottom text-sm",t),...e})}));Table.displayName="Table";const TableHeader=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("thead",{ref:n,className:cn("[&_tr]:border-b",t),...e}));TableHeader.displayName="TableHeader";const TableBody=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tbody",{ref:n,className:cn("[&_tr:last-child]:border-0",t),...e}));TableBody.displayName="TableBody";const TableFooter=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tfoot",{ref:n,className:cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));TableFooter.displayName="TableFooter";const TableRow=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tr",{ref:n,className:cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));TableRow.displayName="TableRow";const TableHead=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("th",{ref:n,className:cn("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e,children:React__namespace.isValidElement(e.children)&&e.children.type==="span"?e.children:jsxRuntime.jsx("span",{children:e.children})}));TableHead.displayName="TableHead";const TableCell=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("td",{ref:n,className:cn("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e,children:React__namespace.isValidElement(e.children)&&e.children.type==="span"?e.children:jsxRuntime.jsx("span",{children:e.children})}));TableCell.displayName="TableCell";const TableCaption=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("caption",{ref:n,className:cn("mt-4 text-sm text-muted-foreground",t),...e}));TableCaption.displayName="TableCaption";const Topbar=React.forwardRef(({onSignOut:t,handleValidSearch:e,rightMenu:n,searchPlaceholder:o},l)=>{const[d,f]=React.useState(""),g=reactRouterDom.useLocation(),{toast:b}=useToast();React.useEffect(()=>{const C=new URLSearchParams(g.search).get("q");C&&f(C)},[g.search]);const _=()=>{const R=d.trim();if(!R||R.length<2){b({title:"Enter more characters to search",description:"At least 2 characters are needed to search products.",variant:"destructive",duration:5e3});return}e(R)},S=R=>{R.key==="Enter"&&_()};return jsxRuntime.jsxs("header",{className:"flex h-16 items-center gap-4 border-b sidebar-foreground bg-sidebar px-6 fixed top-0 right-0 z-50 lg:left-64 left-0 border-sidebar-border",children:[jsxRuntime.jsx(SidebarTrigger,{className:"lg:hidden",children:jsxRuntime.jsx(Menu$1,{className:"h-6 w-6"})}),jsxRuntime.jsx("div",{className:"flex flex-1 items-center gap-4",children:jsxRuntime.jsx("div",{className:"relative w-full max-w-sm",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("button",{type:"button",className:"absolute left-2 top-1/2 -translate-y-1/2",onClick:_,"aria-label":"Search",children:jsxRuntime.jsx(Search,{className:"h-4 w-4 text-muted-foreground"})}),jsxRuntime.jsx(Input,{placeholder:o??"Search...",className:"w-full pl-8 bg-white text-black",value:d,onChange:R=>f(R.target.value),onKeyDown:S,ref:l},"topbar-search")]})})}),n||jsxRuntime.jsx(jsxRuntime.Fragment,{}),t&&jsxRuntime.jsx("div",{className:"flex items-center gap-4",children:jsxRuntime.jsxs(Button,{variant:"ghost",size:"icon",className:"h-9 w-9",onClick:t,children:[jsxRuntime.jsx(LogOut,{className:"h-4 w-4 text-sidebar-foreground"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Sign out"})]})})]})});Topbar.displayName="Topbar";function ActiveOrdersCard({orders:t,loading:e=!1}){const n=d=>new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:2}).format(d),o=React.useMemo(()=>{if(!t||t.length===0)return{all:{orders:0,amount:0},processing:{orders:0,amount:0},shipped:{orders:0,amount:0},delayed:{orders:0,amount:0}};const d=t.filter(j=>j.DocumentType==="Order"),f=t.filter(j=>j.DocumentType==="Shipment"),g=d.filter(j=>j.WarehouseCode!=="3PLE"),b=g.reduce((j,q)=>j+(q.Quantity||0),0),_=g.reduce((j,q)=>j+(q.ExtendedPrice||0),0),S=d.filter(j=>j.WarehouseCode==="3PLE"),R=S.reduce((j,q)=>j+(q.Quantity||0),0),C=S.reduce((j,q)=>j+(q.ExtendedPrice||0),0),E=f.length,A=f.reduce((j,q)=>j+(q.ExtendedPrice||0),0),I=b+R+E,M=_+C+A;return{all:{orders:I,amount:M},processing:{orders:b,amount:_},shipped:{orders:E,amount:A},delayed:{orders:R,amount:C}}},[t]),l=[{name:"All",icon:Package,color:"bg-blue-500",textColor:"text-blue-600",orders:o.all.orders,amount:o.all.amount},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",textColor:"text-yellow-600",orders:o.processing.orders,amount:o.processing.amount},{name:"Shipped",icon:Truck,color:"bg-green-500",textColor:"text-green-600",orders:o.shipped.orders,amount:o.shipped.amount},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",textColor:"text-red-600",orders:o.delayed.orders,amount:o.delayed.amount}];return e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-4 p-4",children:[1,2,3,4].map(d=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:"bg-slate-200 dark:bg-slate-700 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]},d))})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-4 p-4",children:l.map(d=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:`${d.color} bg-opacity-60 h-[3px]`}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-base",children:d.name}),jsxRuntime.jsx("div",{className:`${d.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(d.icon,{className:"size-4 shrink-0 text-white"})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Orders"}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:d.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:n(d.amount)})]})]})]})]},d.name))})]})}var __create=Object.create,__getProtoOf=Object.getPrototypeOf,__defProp=Object.defineProperty,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__toESM=(t,e,n)=>{n=t!=null?__create(__getProtoOf(t)):{};const o=e||!t||!t.__esModule?__defProp(n,"default",{value:t,enumerable:!0}):n;for(let l of __getOwnPropNames(t))__hasOwnProp.call(o,l)||__defProp(o,l,{get:()=>t[l],enumerable:!0});return o},__commonJS=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),require_xhtml=__commonJS((t,e)=>{e.exports={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}}),require_acorn=__commonJS((t,e)=>{(function(n,o){typeof t=="object"&&typeof e<"u"?o(t):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.acorn={}))})(t,function(n){var o=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],l=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],d="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࢘-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",f="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟊꟐꟑꟓꟕ-ꟙꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",g={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},b="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",_={5:b,"5module":b+" export import",6:b+" const class extends export import super"},S=/^in(stanceof)?$/,R=new RegExp("["+f+"]"),C=new RegExp("["+f+d+"]");function E(V,se){for(var Oe=65536,Le=0;Le<se.length;Le+=2){if(Oe+=se[Le],Oe>V)return!1;if(Oe+=se[Le+1],Oe>=V)return!0}return!1}function A(V,se){return V<65?V===36:V<91?!0:V<97?V===95:V<123?!0:V<=65535?V>=170&&R.test(String.fromCharCode(V)):se===!1?!1:E(V,l)}function I(V,se){return V<48?V===36:V<58?!0:V<65?!1:V<91?!0:V<97?V===95:V<123?!0:V<=65535?V>=170&&C.test(String.fromCharCode(V)):se===!1?!1:E(V,l)||E(V,o)}var M=function(se,Oe){Oe===void 0&&(Oe={}),this.label=se,this.keyword=Oe.keyword,this.beforeExpr=!!Oe.beforeExpr,this.startsExpr=!!Oe.startsExpr,this.isLoop=!!Oe.isLoop,this.isAssign=!!Oe.isAssign,this.prefix=!!Oe.prefix,this.postfix=!!Oe.postfix,this.binop=Oe.binop||null,this.updateContext=null};function j(V,se){return new M(V,{beforeExpr:!0,binop:se})}var q={beforeExpr:!0},z={startsExpr:!0},Q={};function F(V,se){return se===void 0&&(se={}),se.keyword=V,Q[V]=new M(V,se)}var O={num:new M("num",z),regexp:new M("regexp",z),string:new M("string",z),name:new M("name",z),privateId:new M("privateId",z),eof:new M("eof"),bracketL:new M("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new M("]"),braceL:new M("{",{beforeExpr:!0,startsExpr:!0}),braceR:new M("}"),parenL:new M("(",{beforeExpr:!0,startsExpr:!0}),parenR:new M(")"),comma:new M(",",q),semi:new M(";",q),colon:new M(":",q),dot:new M("."),question:new M("?",q),questionDot:new M("?."),arrow:new M("=>",q),template:new M("template"),invalidTemplate:new M("invalidTemplate"),ellipsis:new M("...",q),backQuote:new M("`",z),dollarBraceL:new M("${",{beforeExpr:!0,startsExpr:!0}),eq:new M("=",{beforeExpr:!0,isAssign:!0}),assign:new M("_=",{beforeExpr:!0,isAssign:!0}),incDec:new M("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new M("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:j("||",1),logicalAND:j("&&",2),bitwiseOR:j("|",3),bitwiseXOR:j("^",4),bitwiseAND:j("&",5),equality:j("==/!=/===/!==",6),relational:j("</>/<=/>=",7),bitShift:j("<</>>/>>>",8),plusMin:new M("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:j("%",10),star:j("*",10),slash:j("/",10),starstar:new M("**",{beforeExpr:!0}),coalesce:j("??",1),_break:F("break"),_case:F("case",q),_catch:F("catch"),_continue:F("continue"),_debugger:F("debugger"),_default:F("default",q),_do:F("do",{isLoop:!0,beforeExpr:!0}),_else:F("else",q),_finally:F("finally"),_for:F("for",{isLoop:!0}),_function:F("function",z),_if:F("if"),_return:F("return",q),_switch:F("switch"),_throw:F("throw",q),_try:F("try"),_var:F("var"),_const:F("const"),_while:F("while",{isLoop:!0}),_with:F("with"),_new:F("new",{beforeExpr:!0,startsExpr:!0}),_this:F("this",z),_super:F("super",z),_class:F("class",z),_extends:F("extends",q),_export:F("export"),_import:F("import",z),_null:F("null",z),_true:F("true",z),_false:F("false",z),_in:F("in",{beforeExpr:!0,binop:7}),_instanceof:F("instanceof",{beforeExpr:!0,binop:7}),_typeof:F("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:F("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:F("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},te=/\r\n?|\n|\u2028|\u2029/,ne=new RegExp(te.source,"g");function ae(V){return V===10||V===13||V===8232||V===8233}function ge(V,se,Oe){Oe===void 0&&(Oe=V.length);for(var Le=se;Le<Oe;Le++){var Ge=V.charCodeAt(Le);if(ae(Ge))return Le<Oe-1&&Ge===13&&V.charCodeAt(Le+1)===10?Le+2:Le+1}return-1}var oe=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,je=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Ne=Object.prototype,Ae=Ne.hasOwnProperty,$e=Ne.toString,Fe=Object.hasOwn||function(V,se){return Ae.call(V,se)},ze=Array.isArray||function(V){return $e.call(V)==="[object Array]"},Ve=Object.create(null);function Be(V){return Ve[V]||(Ve[V]=new RegExp("^(?:"+V.replace(/ /g,"|")+")$"))}function qe(V){return V<=65535?String.fromCharCode(V):(V-=65536,String.fromCharCode((V>>10)+55296,(V&1023)+56320))}var Ke=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,He=function(se,Oe){this.line=se,this.column=Oe};He.prototype.offset=function(se){return new He(this.line,this.column+se)};var Xe=function(se,Oe,Le){this.start=Oe,this.end=Le,se.sourceFile!==null&&(this.source=se.sourceFile)};function tt(V,se){for(var Oe=1,Le=0;;){var Ge=ge(V,Le,se);if(Ge<0)return new He(Oe,se-Le);++Oe,Le=Ge}}var Ye={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},et=!1;function Ze(V){var se={};for(var Oe in Ye)se[Oe]=V&&Fe(V,Oe)?V[Oe]:Ye[Oe];if(se.ecmaVersion==="latest"?se.ecmaVersion=1e8:se.ecmaVersion==null?(!et&&typeof console=="object"&&console.warn&&(et=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
1048
+ `).map(e=>jsxRuntime.jsx("p",{children:e}));function ChatMessages({messages:t,currentUserId:e,botStatus:n,isAssistantChat:o}){return jsxRuntime.jsxs("div",{children:[t.map(l=>{const d=l.fromPartnerID===e;return jsxRuntime.jsxs("div",{className:cn("flex items-start gap-2 mt-2 mb-2",d&&"flex-row-reverse"),children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 mt-1",children:jsxRuntime.jsx(AvatarImage,{src:`https://api.dicebear.com/9.x/thumbs/svg?seed=${md5(l.senderName+l.fromPartnerID)}&flip=${d}`})}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsxs("p",{className:"mb-1",children:[l.senderName,jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground mt-1 ml-3",children:(()=>{const f=new Date(l.timestamp);return isToday(f)?f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}):isYesterday(f)?`Yesterday, ${f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`:`${f.toLocaleDateString([],{month:"short",day:"numeric"})} ${f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`})()})]}),jsxRuntime.jsx("div",{className:cn("rounded-md p-3 break-words [&_li]:ml-6 [&_li]:list-disc [&_h1]:text-lg [&_h1]:font-bold [&_h1]:mt-4 [&_h2]:font-bold [&_h2]:mt-4 [&_h3]:mt-4 ",d?"bg-primary text-white rounded-tr-none":"bg-white border rounded-tl-none"),children:l.fromPartnerID===ASSISTANT_ID?parser(l.content):toHTML(l.content)})]})]},l.id)}),n!==""&&jsxRuntime.jsx(SkeletonMessage,{botStatus:n}),t.length===0&&!o&&jsxRuntime.jsx("div",{className:"text-center text-muted-foreground py-8",children:"No messages yet"}),t.length===0&&n===""&&o&&jsxRuntime.jsxs("div",{className:"text-center py-8",children:[jsxRuntime.jsx("p",{children:"The Randmar Assistant is ready to help you. Ask anything about products, orders, carts, shipments and tracking numbers."}),jsxRuntime.jsx("p",{children:jsxRuntime.jsx("strong",{children:'Try it now, type "my open orders"!'})})]})]})}var SWITCH_NAME="Switch",[createSwitchContext,createSwitchScope]=createContextScope(SWITCH_NAME),[SwitchProvider,useSwitchContext]=createSwitchContext(SWITCH_NAME),Switch$1=React__namespace.forwardRef((t,e)=>{const{__scopeSwitch:n,name:o,checked:l,defaultChecked:d,required:f,disabled:g,value:b="on",onCheckedChange:_,form:S,...R}=t,[C,E]=React__namespace.useState(null),A=useComposedRefs(e,z=>E(z)),I=React__namespace.useRef(!1),M=C?S||!!C.closest("form"):!0,[j,q]=useControllableState({prop:l,defaultProp:d??!1,onChange:_,caller:SWITCH_NAME});return jsxRuntime.jsxs(SwitchProvider,{scope:n,checked:j,disabled:g,children:[jsxRuntime.jsx(Primitive.button,{type:"button",role:"switch","aria-checked":j,"aria-required":f,"data-state":getState$2(j),"data-disabled":g?"":void 0,disabled:g,value:b,...R,ref:A,onClick:composeEventHandlers(t.onClick,z=>{q(Q=>!Q),M&&(I.current=z.isPropagationStopped(),I.current||z.stopPropagation())})}),M&&jsxRuntime.jsx(SwitchBubbleInput,{control:C,bubbles:!I.current,name:o,value:b,checked:j,required:f,disabled:g,form:S,style:{transform:"translateX(-100%)"}})]})});Switch$1.displayName=SWITCH_NAME;var THUMB_NAME="SwitchThumb",SwitchThumb=React__namespace.forwardRef((t,e)=>{const{__scopeSwitch:n,...o}=t,l=useSwitchContext(THUMB_NAME,n);return jsxRuntime.jsx(Primitive.span,{"data-state":getState$2(l.checked),"data-disabled":l.disabled?"":void 0,...o,ref:e})});SwitchThumb.displayName=THUMB_NAME;var BUBBLE_INPUT_NAME$2="SwitchBubbleInput",SwitchBubbleInput=React__namespace.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:o=!0,...l},d)=>{const f=React__namespace.useRef(null),g=useComposedRefs(f,d),b=usePrevious(n),_=useSize(e);return React__namespace.useEffect(()=>{const S=f.current;if(!S)return;const R=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(R,"checked").set;if(b!==n&&E){const A=new Event("click",{bubbles:o});E.call(S,n),S.dispatchEvent(A)}},[b,n,o]),jsxRuntime.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...l,tabIndex:-1,ref:g,style:{...l.style,..._,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});SwitchBubbleInput.displayName=BUBBLE_INPUT_NAME$2;function getState$2(t){return t?"checked":"unchecked"}var Root$1=Switch$1,Thumb=SwitchThumb;const Switch=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Root$1,{className:cn("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:jsxRuntime.jsx(Thumb,{className:cn("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Switch.displayName=Root$1.displayName;const DebugMessageDisplay=({debugMessages:t})=>{const[e,n]=React.useState({}),o=l=>{n(d=>({...d,[l]:!d[l]}))};return jsxRuntime.jsx("div",{children:t.map((l,d)=>{if(typeof l=="string")return jsxRuntime.jsx("p",{className:"text-slate-600",children:l},d);{const f=e[d];return jsxRuntime.jsxs("div",{className:"cursor-pointer",onClick:()=>o(d),children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("p",{className:"text-slate-600 mr-2",children:l[0]}),jsxRuntime.jsx("span",{className:"text-slate-500 text-xs",children:f?"▲":"▼"})]}),f&&jsxRuntime.jsx("p",{className:"text-slate-400 pl-4",children:l[1]})]},d)}})})},ASSISTANT_ID="RandmarAIChatAssistant",ChatLayout=React.forwardRef(({userId:t,userName:e,apiKey:n,inputRef:o},l)=>{const{data:d,refetch:f}=useGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationsQuery({routeApplicationId:t}),[g]=useLazyGetV4PartnerByApplicationIdAccountQuery(),[b]=usePostV4PartnerByApplicationIdAccountDebugFeedbackMutation(),[_,{isLoading:S}]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),[R,C]=React.useState(!1),E=React.useRef(null),[A]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),[I]=useLazyGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationAndConversationIdMessagesQuery(),{handleSubmitToBot:M,botMessages:j,clearBotMessages:q,botReady:z,debugMessages:Q,botStatus:F,reset:O}=useAIAssistant({userId:t,apiKey:n,smartAndSlow:R});React.useEffect(()=>{if(!d)return;const ut={partner1:t,partner2:ASSISTANT_ID,name:"Randmar Assistant",unread:0,pending:!1,historyFetched:!0,messages:[],conversationID:-1},Mt=d.map(Ut=>{var yt;return{partner1:Ut.Participant1,partner2:Ut.Participant2,name:((yt=Ut.Participant)==null?void 0:yt.PublicName)??"missing public name",unread:0,pending:Ut.Status!="Approved",historyFetched:!1,messages:[],conversationID:Ut.ConversationId}});setTimeout(()=>{var Ut;return(Ut=it.current)==null?void 0:Ut.focus()},50),Fe([ut,...Mt])},[d]);const[te,ne]=React.useState("approved"),[ae,ge]=React.useState([t,ASSISTANT_ID]),[oe,je]=React.useState(""),[Ne,Ae]=React.useState(null),[$e,Fe]=React.useState([]),[ze,Ve]=React.useState(""),[Be,qe]=React.useState(null),[Ke,He]=React.useState([]),[,Xe]=React.useState(0),tt=React.useRef(null),Ye=React.useRef(null),[et,Ze]=React.useState(null),[at,rt]=React.useState([]),it=o||Ye,st=React.useRef(null),{toast:Ue}=useToast(),Rt=$e.filter(ut=>{const Mt=ut.name.toLowerCase().includes(ze.toLowerCase());return te==="approved"?Mt&&!ut.pending:te==="pending"?Mt&&ut.pending:Mt});React.useEffect(()=>{var ut;et!==null&&(Ue({title:"File attached",description:"Add your instruction before sending.",variant:"success"}),(ut=it.current)==null||ut.focus())},[et]),React.useEffect(()=>{j.length!==0&&(j.forEach(ut=>{if(!ut)return;if(ut.isComponent){He(Ut=>[...Ut,ut.content]),Xe(0);return}const Mt={id:ut.timestamp.toString(),fromPartnerID:ASSISTANT_ID,toPartnerID:t,senderName:"Assistant",timestamp:ut.timestamp.getTime(),content:ut.content};Mt.content=marked(Mt.content,{async:!1}),Je(Mt)}),q())},[j]);function Je(ut){const Mt=[ut.fromPartnerID,ut.toPartnerID];Mt.sort(),Fe(Ut=>{let yt=!1;const nr=Ut.map(er=>er.partner1!==Mt[0]||er.partner2!==Mt[1]||er.messages.findIndex(lr=>lr.id==ut.id)!==-1?er:(yt=!0,{...er,unread:er.unread+1,messages:[...er.messages,ut]}));return yt&&Ae([Mt[0],Mt[1]]),nr})}React.useEffect(()=>{const ut=new HubConnectionBuilder().withUrl("https://api.randmar.io/hub",{accessTokenFactory:()=>localStorage.getItem("access_token"),headers:{"X-Impersonated-Id":t}}).configureLogging(LogLevel.Information).withAutomaticReconnect().withHubProtocol(new JsonHubProtocol).build();return ut.on("ReceiveMessage",Je),ut.start().catch(Mt=>console.error("Error connecting to SignalR hub:",Mt)),qe(ut),()=>{ut&&ut.stop()}},[t]),React.useEffect(()=>{(Ne==null?void 0:Ne[0])!==(ae==null?void 0:ae[0])||(Ne==null?void 0:Ne[1])!==(ae==null?void 0:ae[1])||(Fe(ut=>ut.map(Mt=>Mt.partner1===(ae==null?void 0:ae[0])&&Mt.partner2===(ae==null?void 0:ae[1])?{...Mt,unread:0}:Mt)),setTimeout(()=>{var ut;return(ut=tt.current)==null?void 0:ut.scrollIntoView({behavior:"smooth"})},50))},[Ne,ae]),React.useEffect(()=>{if(!ae)return;const ut=getActiveChatObject($e,ae);if(ut){if(ut.historyFetched){ut.unread>0&&Fe(Mt=>Mt.map(Ut=>Ut.partner1===ae[0]&&Ut.partner2===ae[1]?{...Ut,unread:0}:Ut)),setTimeout(()=>{var Mt;return(Mt=tt.current)==null?void 0:Mt.scrollIntoView({behavior:"smooth"})},50);return}I({routeApplicationId:t,conversationId:ut.conversationID}).unwrap().then(Mt=>{const Ut=Mt.map(yt=>({id:"history"+yt.MessageId,fromPartnerID:yt.SenderId,toPartnerID:yt.SenderId==ae[0]?ae[1]:ae[0],senderName:yt.SenderName??"missing name",timestamp:new Date(yt.SentDate+"Z").getTime(),content:yt.Content??"no content"}));Fe(yt=>yt.map(nr=>nr.partner1===ae[0]&&nr.partner2===ae[1]?{...nr,messages:Ut,historyFetched:!0}:nr))}).catch(Mt=>{console.error("Error fetching conversation messages:",Mt)})}},[$e,ae,I,t]),React.useEffect(()=>{var Mt;if(Xe(Ke.length),!ae)return;const ut=getActiveChatObject($e,ae);ut&&((Mt=it.current)==null||Mt.focus(),g({applicationId:ut.partner1===t?ut.partner2:ut.partner1}).then(Ut=>{Ut.data&&(He(yt=>[...yt,jsxRuntime.jsx("div",{className:"mt-2",children:jsxRuntime.jsx(PartnerCard,{account:Ut.data,action:jsxRuntime.jsx(jsxRuntime.Fragment,{}),withVoice:!1})})]),Xe(0))}))},[ae,t]);const mt=(ut,Mt,Ut)=>{const yt={id:crypto.randomUUID(),senderName:e,fromPartnerID:t,toPartnerID:Mt[0]===t?Mt[1]:Mt[0],content:ut+(et?` (${et==null?void 0:et.name} attached)`:""),timestamp:Date.now()};Fe(nr=>nr.map(er=>er.partner1===Mt[0]&&er.partner2===Mt[1]?{...er,messages:[...er.messages,yt]}:er)),Ae([Mt[0],Mt[1]]),yt.toPartnerID==ASSISTANT_ID?(M(yt.content,et??void 0),et&&rt(nr=>[...nr,et.name])):Ut.invoke("NewMessage",yt).catch(nr=>console.error("Error sending message:",nr)),je(""),Ze(null),st.current&&(st.current.value="")},$t=(ut,Mt)=>{if(!$e.length||!Be||!z)return!1;const Ut=$e.find(yt=>yt.conversationID===ut);return Ut?(Ut.pending&&setTimeout(()=>ne("pending"),300),ge([Ut.partner1,Ut.partner2]),Mt&&setTimeout(()=>mt(Mt,[Ut.partner1,Ut.partner2],Be),300),!0):!1};if(React.useImperativeHandle(l,()=>({setActiveChatAndSendMessage:$t})),!z)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("div",{className:"flex items-center justify-center p-8",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto mb-4"}),jsxRuntime.jsx("p",{children:"Loading API functions..."})]})})});const Dt=ut=>{var Ut;if(!isAssistantChat(ae))return;const Mt=(Ut=ut.clipboardData)==null?void 0:Ut.items;if(Mt){for(let yt=0;yt<Mt.length;yt++)if(Mt[yt].type.indexOf("image")!==-1){const nr=Mt[yt].getAsFile();if(nr){Ze(nr);return}}}},Ht=()=>{!oe.trim()||!ae||!Be||(Xe(Ke.length),mt(oe,ae,Be))},Vt=ut=>{ut.target.files&&ut.target.files[0]?Ze(ut.target.files[0]):Ze(null)},We=()=>{var ut;(ut=st.current)==null||ut.click()},nt=()=>{var ut;Ze(null),Ue({title:"File removed",description:"No file will be sent to the assistant.",variant:"secondary"}),(ut=it.current)==null||ut.focus()},Qe=()=>{const Mt={messages:$e.find(Ut=>Ut.partner1===ASSISTANT_ID||Ut.partner2===ASSISTANT_ID),debug:Q};b({applicationId:t,emailAddress:e,body:Mt})},dt=async()=>{E.current&&(E.current.disabled=!0),await A({routeApplicationId:t,partnerId:"2"}),await f()},pt=()=>{Fe(ut=>ut.map(Ut=>Ut.partner1!==ASSISTANT_ID&&Ut.partner2!==ASSISTANT_ID?Ut:{...Ut,messages:[]})),rt([]),O()},ft=()=>{ae&&_({routeApplicationId:t,partnerId:ae[0]==t?ae[1]:ae[0]}).then(()=>{ne("approved")})},ct=getActiveChatObject($e,ae),qt=$e.filter(ut=>ut.pending).length;return jsxRuntime.jsxs("div",{className:"flex h-[85vh] overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"w-[260px] p-4 pt-3 flex flex-col border-r",children:[jsxRuntime.jsx("div",{className:"p-4 font-semibold border-b",children:"Communications"}),$e.length>1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"p-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(Search,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),jsxRuntime.jsx(Input,{placeholder:"Search chats...",className:"pl-8 h-9",value:ze,onChange:ut=>Ve(ut.target.value)})]})}),jsxRuntime.jsx(Tabs,{value:te,onValueChange:ne,className:"w-full mb-1",children:jsxRuntime.jsxs(TabsList,{className:"grid grid-cols-6 h-9 mx-2",children:[jsxRuntime.jsx(TabsTrigger,{value:"approved",className:"text-xs col-span-3",children:"Approved"}),jsxRuntime.jsxs(TabsTrigger,{value:"pending",className:"text-xs col-span-3",children:["Pending ",qt>0&&`(${qt})`]})]})})]}),jsxRuntime.jsx("div",{className:"mt-1 mb-1",children:$e.findIndex(ut=>ut.partner1==="2"||ut.partner2==="2")<0?jsxRuntime.jsx(Button,{className:"w-full",ref:E,onClick:()=>dt(),children:"Chat with Randmar"},"b1"):jsxRuntime.jsx("a",{target:"_blank",href:`https://dashboard.randmar.io/${t}/ExploreManufacturers`,children:jsxRuntime.jsx(Button,{className:"w-full",children:"Explore manufacturers"},"b2")})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1",children:$e.length&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(ChatList,{userId:t,chats:Rt.filter(ut=>ut.partner1!=ASSISTANT_ID&&ut.partner2!=ASSISTANT_ID),activeChat:ct??null,onSelectChat:ge,assistantChat:$e.find(ut=>ut.partner1==ASSISTANT_ID||ut.partner2==ASSISTANT_ID)})})})]}),jsxRuntime.jsx("div",{className:"flex-3 flex flex-col",children:ae?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:ae[0]==ASSISTANT_ID||ae[1]==ASSISTANT_ID?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:jsxRuntime.jsx(Bot,{className:"text-primary fill-white min-h-full"})}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:"Randmar Assistant"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 ml-auto",children:[jsxRuntime.jsx(Switch,{id:"smartSwitch",disabled:!!F,checked:R,onCheckedChange:ut=>{pt(),setTimeout(()=>C(ut),20)}}),jsxRuntime.jsx(Label$2,{htmlFor:"smartSwitch",children:"Think harder"})]}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-1",onClick:()=>pt(),children:jsxRuntime.jsx(MessageCircleX,{className:"h-5 w-5"})}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-1",confirmationDialog:{title:"Report Issue",content:"This action will send a copy of your chat to Randmar. Send it?",onConfirm:()=>Qe()},children:jsxRuntime.jsx(MessageSquareShare,{className:"h-5 w-5"})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:[jsxRuntime.jsx(AvatarImage,{src:`https://api.randmar.io/v4/Partner/${ae[0]===t?ae[1]:ae[0]}/Account/Logo?height=72&width=72`,className:" object-contain "}),jsxRuntime.jsx(AvatarFallback,{children:jsxRuntime.jsx(Handshake,{className:"text-primary fill-white min-h-full"})})]}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:ct==null?void 0:ct.name}),jsxRuntime.jsx("div",{className:"flex items-center space-x-2 ml-auto",children:jsxRuntime.jsx("a",{href:`https://dashboard.randmar.io/${t}/Partner/${ae[0]===t?ae[1]:ae[0]}`,target:"_blank",children:jsxRuntime.jsx(Button,{children:"View Partner"})})})]})}),ct!=null&&ct.pending&&ct.partner1==t?jsxRuntime.jsx("p",{className:"mt-8 p-2 mx-auto",children:"This conversation is awaiting approval by the other party — please check back later."}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:[jsxRuntime.jsx(ChatMessages,{messages:(ct==null?void 0:ct.messages)??[],currentUserId:t,isAssistantChat:isAssistantChat(ae),botStatus:isAssistantChat(ae)?F:""}),jsxRuntime.jsx("div",{ref:tt})]}),jsxRuntime.jsxs("div",{className:"p-4 border-t flex",children:[(ct==null?void 0:ct.pending)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{disabled:S,onClick:()=>ft(),children:[jsxRuntime.jsx(Handshake,{}),"Accept Conversation Request"]}),jsxRuntime.jsxs(Button,{disabled:!0,className:"ml-2",children:[jsxRuntime.jsx(ThumbsDown,{}),"Block Partner"]})]}),jsxRuntime.jsx(Textarea,{ref:it,placeholder:"Type a message...",value:oe,onPaste:Dt,onChange:ut=>je(ut.target.value),onKeyDown:ut=>{ut.key!=="Enter"||ut.shiftKey||(ut.preventDefault(),Ht())},className:ct!=null&&ct.pending?"collapse":"flex-1 resize-none"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Button,{size:"icon",variant:"default",className:ct!=null&&ct.pending?"collapse":"ml-2 h-8 w-8",disabled:!!F||(ct==null?void 0:ct.pending),onClick:Ht,children:jsxRuntime.jsx(Send,{className:"h-6 w-6"})}),isAssistantChat(ae)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Input,{type:"file",onChange:Vt,className:"hidden",ref:st}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:We,className:ct!=null&&ct.pending?"collapse":"ml-2 h-8 w-8",disabled:F!==""||(ct==null?void 0:ct.pending)||!!et,children:jsxRuntime.jsx(Paperclip,{className:"h-5 w-5"})}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:nt,className:ct!=null&&ct.pending?"collapse":"ml-2 h-8 w-8",disabled:F!==""||(ct==null?void 0:ct.pending)||!et,children:jsxRuntime.jsx(Trash,{className:"h-5 w-5"})})]})]})]})]})]}):jsxRuntime.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Select a chat to start messaging"})}),jsxRuntime.jsx("div",{className:"w-[480px] flex flex-2 flex-col border-l",children:isAssistantChat(ae)?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Sources and System Info"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[et?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx(File,{})," ",et.name," (pending send...)"]})}):at.length?jsxRuntime.jsx(jsxRuntime.Fragment,{}):jsxRuntime.jsx("p",{children:"No files attached to this conversation yet."}),at.slice().reverse().map(ut=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx(File,{})," ",ut]})}))]})}),jsxRuntime.jsx(ScrollArea,{className:"flex-4 border-t pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx("div",{className:"space-y-2",children:jsxRuntime.jsx(DebugMessageDisplay,{debugMessages:Q})})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Partner Overview"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx(PartnerRelationshipPage,{applicationId:t,partnerId:((ae==null?void 0:ae[0])===t?ae[1]:ae==null?void 0:ae[0])??t,userEmail:e,shopifyHostName:void 0,isSuperAdmin:!1})})]})})]})});function getActiveChatObject(t,e){return t.find(n=>n.partner1==(e==null?void 0:e[0])&&n.partner2==(e==null?void 0:e[1]))}function isAssistantChat(t){return(t==null?void 0:t[0])==ASSISTANT_ID||(t==null?void 0:t[1])==ASSISTANT_ID}const alertVariants=cva("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",success:"border-green-500/50 bg-green-50 text-green-700 dark:border-green-500 dark:bg-green-950 dark:text-green-400 [&>svg]:text-green-500",warning:"border-yellow-500/50 bg-yellow-50 text-yellow-700 dark:border-yellow-500 dark:bg-yellow-950 dark:text-yellow-400 [&>svg]:text-yellow-500",info:"border-blue-500/50 bg-blue-50 text-blue-700 dark:border-blue-500 dark:bg-blue-950 dark:text-blue-400 [&>svg]:text-blue-500"}},defaultVariants:{variant:"default"}}),Alert=React__namespace.forwardRef(({className:t,variant:e,...n},o)=>jsxRuntime.jsx("div",{ref:o,role:"alert",className:cn(alertVariants({variant:e}),t),...n}));Alert.displayName="Alert";const AlertTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("h5",{ref:n,className:cn("mb-1 font-medium leading-none tracking-tight",t),...e}));AlertTitle.displayName="AlertTitle";const AlertDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("text-sm [&_p]:leading-relaxed",t),...e}));AlertDescription.displayName="AlertDescription";function QualificationBadge({qualification:t}){return!t.QualificationId||t.QualificationId==="Suspended"?null:t.QualificationId==="Do Not Sell"?jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"destructive",children:[jsxRuntime.jsx(X$1,{className:"h-3 w-3 mr-1"}),"Do Not Sell"]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})}):jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"info",className:t.DefaultOpportunityNumber?"pr-1":"",children:[jsxRuntime.jsx(BadgeCheck,{className:"h-3 w-3 mr-1"}),t.QualificationId,t.DefaultOpportunityNumber&&jsxRuntime.jsx(Badge,{variant:"secondary",size:"sm",className:"ml-1",children:t.DefaultOpportunityNumber})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})})}function ManufacturerCard({manufacturer:t,link:e,linkNewTab:n=!0,actions:o,mainAction:l,loading:d=!1}){var C,E,A;if(d||!t)return jsxRuntime.jsxs(Card,{className:"flex flex-col h-full",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]}),jsxRuntime.jsx(Skeleton,{className:"h-16 w-24"})]}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex flex-col space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const f=t.ManufacturerId||"N/A",g=[t.City,t.Province,t.Country].filter(Boolean),b=g.length>0?g.join(", "):"",_=((C=t.Tags)==null?void 0:C.split(",").map(I=>I.trim()).filter(Boolean))||[],R=(I=>!I||I.length===0?[]:[...I].sort((M,j)=>(M.Day||0)-(j.Day||0)).map(M=>({date:M.Day||0,amount:M.ExtendedPrice||0})))(t.SalesStatistics);return jsxRuntime.jsxs(Card,{className:"manufacturer-theme flex flex-col h-full",children:[jsxRuntime.jsx(reactRouterDom.Link,{to:e??"#",target:e&&n?"_blank":"_self",children:jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx(PartnerLogo,{id:t.ManufacturerId,width:48,height:48})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Manufacturer"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:f})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"}),t.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t.Name}),b&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:b})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:R.length>0&&jsxRuntime.jsx("div",{className:"h-16 w-24",children:jsxRuntime.jsx(AreaChart,{data:R,height:60,size:"mini"})})})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[(!!((E=t.Qualification)!=null&&E.QualificationId)&&((A=t.Qualification)==null?void 0:A.QualificationId)!=="Suspended"||!!t.OpenToWork||_.length>0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(QualificationBadge,{qualification:t.Qualification??{}}),!!t.OpenToWork&&jsxRuntime.jsxs(Badge,{variant:"success",children:[jsxRuntime.jsx(HardHat,{className:"h-3 w-3 mr-1"}),"Open To Work"]}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"}),_.map((I,M)=>jsxRuntime.jsx(Badge,{variant:"outline",children:I},M))]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${t.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${t.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:t.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})]}),t.SalesData&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:t.SalesData.SalesYearToDay?formatMoney(t.SalesData.SalesYearToDay):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:t.SalesData.SalesLast3Months?formatMoney(t.SalesData.SalesLast3Months):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:t.SalesData.SalesLast30Days?formatMoney(t.SalesData.SalesLast30Days):"—"})]})]})}),(o||l)&&jsxRuntime.jsxs(CardFooter,{className:"flex pt-2 gap-2 justify-between mt-auto",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:o&&o}),l&&jsxRuntime.jsx("div",{children:l})]})]})}function ResellerCard({reseller:t,link:e,actions:n,loading:o=!1}){var g,b;if(o||!t)return jsxRuntime.jsxs(Card,{className:"flex flex-col h-full",children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsx("div",{className:"flex",children:jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const l=t.ResellerId||"N/A",d=[t.City,t.Province,t.Country].filter(Boolean),f=d.length>0?d.join(", "):"Location not provided";return jsxRuntime.jsxs(Card,{className:"reseller-theme flex flex-col h-full",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx(PartnerLogo,{id:t.ResellerId,width:48,height:48})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Reseller"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:l})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"}),t.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t.Name}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:f})]})]}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"})]}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[!!((g=t.Qualification)!=null&&g.QualificationId)&&((b=t.Qualification)==null?void 0:b.QualificationId)!=="Suspended"&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:jsxRuntime.jsx(QualificationBadge,{qualification:t.Qualification??{}})}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${t.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${t.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:t.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})]}),(t==null?void 0:t.SalesData)&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesYearToDay?formatMoney(t==null?void 0:t.SalesData.SalesYearToDay):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesLast3Months?formatMoney(t==null?void 0:t.SalesData.SalesLast3Months):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesLast30Days?formatMoney(t==null?void 0:t.SalesData.SalesLast30Days):"—"})]})]})}),(n||e)&&jsxRuntime.jsxs(CardFooter,{className:`flex pt-2 gap-2 mt-auto ${n?"justify-between":"justify-end"}`,children:[n&&n,e&&jsxRuntime.jsx(Button,{className:"flex items-center gap-1",asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:e,target:"_blank",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Reseller"]})})]})]})}const Table=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{className:"relative w-full overflow-auto",children:jsxRuntime.jsx("table",{ref:n,className:cn("w-full caption-bottom text-sm",t),...e})}));Table.displayName="Table";const TableHeader=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("thead",{ref:n,className:cn("[&_tr]:border-b",t),...e}));TableHeader.displayName="TableHeader";const TableBody=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tbody",{ref:n,className:cn("[&_tr:last-child]:border-0",t),...e}));TableBody.displayName="TableBody";const TableFooter=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tfoot",{ref:n,className:cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));TableFooter.displayName="TableFooter";const TableRow=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tr",{ref:n,className:cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));TableRow.displayName="TableRow";const TableHead=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("th",{ref:n,className:cn("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e,children:React__namespace.isValidElement(e.children)&&e.children.type==="span"?e.children:jsxRuntime.jsx("span",{children:e.children})}));TableHead.displayName="TableHead";const TableCell=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("td",{ref:n,className:cn("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e,children:React__namespace.isValidElement(e.children)&&e.children.type==="span"?e.children:jsxRuntime.jsx("span",{children:e.children})}));TableCell.displayName="TableCell";const TableCaption=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("caption",{ref:n,className:cn("mt-4 text-sm text-muted-foreground",t),...e}));TableCaption.displayName="TableCaption";const Topbar=React.forwardRef(({onSignOut:t,handleValidSearch:e,rightMenu:n,searchPlaceholder:o},l)=>{const[d,f]=React.useState(""),g=reactRouterDom.useLocation(),{toast:b}=useToast();React.useEffect(()=>{const C=new URLSearchParams(g.search).get("q");C&&f(C)},[g.search]);const _=()=>{const R=d.trim();if(!R||R.length<2){b({title:"Enter more characters to search",description:"At least 2 characters are needed to search products.",variant:"destructive",duration:5e3});return}e(R)},S=R=>{R.key==="Enter"&&_()};return jsxRuntime.jsxs("header",{className:"flex h-16 items-center gap-4 border-b sidebar-foreground bg-sidebar px-6 fixed top-0 right-0 z-50 lg:left-64 left-0 border-sidebar-border",children:[jsxRuntime.jsx(SidebarTrigger,{className:"lg:hidden",children:jsxRuntime.jsx(Menu$1,{className:"h-6 w-6"})}),jsxRuntime.jsx("div",{className:"flex flex-1 items-center gap-4",children:jsxRuntime.jsx("div",{className:"relative w-full max-w-sm",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("button",{type:"button",className:"absolute left-2 top-1/2 -translate-y-1/2",onClick:_,"aria-label":"Search",children:jsxRuntime.jsx(Search,{className:"h-4 w-4 text-muted-foreground"})}),jsxRuntime.jsx(Input,{placeholder:o??"Search...",className:"w-full pl-8 bg-white text-black",value:d,onChange:R=>f(R.target.value),onKeyDown:S,ref:l},"topbar-search")]})})}),n||jsxRuntime.jsx(jsxRuntime.Fragment,{}),t&&jsxRuntime.jsx("div",{className:"flex items-center gap-4",children:jsxRuntime.jsxs(Button,{variant:"ghost",size:"icon",className:"h-9 w-9",onClick:t,children:[jsxRuntime.jsx(LogOut,{className:"h-4 w-4 text-sidebar-foreground"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Sign out"})]})})]})});Topbar.displayName="Topbar";function ActiveOrdersCard({orders:t,loading:e=!1}){const n=React.useMemo(()=>{if(!t||t.length===0)return{all:{orders:0,amount:0},processing:{orders:0,amount:0},shipped:{orders:0,amount:0},delayed:{orders:0,amount:0}};const l=t.filter(M=>M.DocumentType==="Order"),d=t.filter(M=>M.DocumentType==="Shipment"),f=l.filter(M=>M.WarehouseCode!=="3PLE"),g=f.reduce((M,j)=>M+(j.Quantity||0),0),b=f.reduce((M,j)=>M+(j.ExtendedPrice||0),0),_=l.filter(M=>M.WarehouseCode==="3PLE"),S=_.reduce((M,j)=>M+(j.Quantity||0),0),R=_.reduce((M,j)=>M+(j.ExtendedPrice||0),0),C=d.length,E=d.reduce((M,j)=>M+(j.ExtendedPrice||0),0),A=g+S+C,I=b+R+E;return{all:{orders:A,amount:I},processing:{orders:g,amount:b},shipped:{orders:C,amount:E},delayed:{orders:S,amount:R}}},[t]),o=[{name:"All",icon:Package,color:"bg-blue-500",textColor:"text-blue-600",orders:n.all.orders,amount:n.all.amount},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",textColor:"text-yellow-600",orders:n.processing.orders,amount:n.processing.amount},{name:"Shipped",icon:Truck,color:"bg-green-500",textColor:"text-green-600",orders:n.shipped.orders,amount:n.shipped.amount},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",textColor:"text-red-600",orders:n.delayed.orders,amount:n.delayed.amount}];return e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-4 p-4",children:[1,2,3,4].map(l=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:"bg-slate-200 dark:bg-slate-700 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]},l))})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-4 p-4",children:o.map(l=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:`${l.color} bg-opacity-60 h-[3px]`}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-base",children:l.name}),jsxRuntime.jsx("div",{className:`${l.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(l.icon,{className:"size-4 shrink-0 text-white"})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Orders"}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:l.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:formatMoney(l.amount)})]})]})]})]},l.name))})]})}var __create=Object.create,__getProtoOf=Object.getPrototypeOf,__defProp=Object.defineProperty,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__toESM=(t,e,n)=>{n=t!=null?__create(__getProtoOf(t)):{};const o=e||!t||!t.__esModule?__defProp(n,"default",{value:t,enumerable:!0}):n;for(let l of __getOwnPropNames(t))__hasOwnProp.call(o,l)||__defProp(o,l,{get:()=>t[l],enumerable:!0});return o},__commonJS=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),require_xhtml=__commonJS((t,e)=>{e.exports={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}}),require_acorn=__commonJS((t,e)=>{(function(n,o){typeof t=="object"&&typeof e<"u"?o(t):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.acorn={}))})(t,function(n){var o=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],l=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],d="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࢘-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",f="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟊꟐꟑꟓꟕ-ꟙꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",g={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},b="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",_={5:b,"5module":b+" export import",6:b+" const class extends export import super"},S=/^in(stanceof)?$/,R=new RegExp("["+f+"]"),C=new RegExp("["+f+d+"]");function E(V,se){for(var Oe=65536,Le=0;Le<se.length;Le+=2){if(Oe+=se[Le],Oe>V)return!1;if(Oe+=se[Le+1],Oe>=V)return!0}return!1}function A(V,se){return V<65?V===36:V<91?!0:V<97?V===95:V<123?!0:V<=65535?V>=170&&R.test(String.fromCharCode(V)):se===!1?!1:E(V,l)}function I(V,se){return V<48?V===36:V<58?!0:V<65?!1:V<91?!0:V<97?V===95:V<123?!0:V<=65535?V>=170&&C.test(String.fromCharCode(V)):se===!1?!1:E(V,l)||E(V,o)}var M=function(se,Oe){Oe===void 0&&(Oe={}),this.label=se,this.keyword=Oe.keyword,this.beforeExpr=!!Oe.beforeExpr,this.startsExpr=!!Oe.startsExpr,this.isLoop=!!Oe.isLoop,this.isAssign=!!Oe.isAssign,this.prefix=!!Oe.prefix,this.postfix=!!Oe.postfix,this.binop=Oe.binop||null,this.updateContext=null};function j(V,se){return new M(V,{beforeExpr:!0,binop:se})}var q={beforeExpr:!0},z={startsExpr:!0},Q={};function F(V,se){return se===void 0&&(se={}),se.keyword=V,Q[V]=new M(V,se)}var O={num:new M("num",z),regexp:new M("regexp",z),string:new M("string",z),name:new M("name",z),privateId:new M("privateId",z),eof:new M("eof"),bracketL:new M("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new M("]"),braceL:new M("{",{beforeExpr:!0,startsExpr:!0}),braceR:new M("}"),parenL:new M("(",{beforeExpr:!0,startsExpr:!0}),parenR:new M(")"),comma:new M(",",q),semi:new M(";",q),colon:new M(":",q),dot:new M("."),question:new M("?",q),questionDot:new M("?."),arrow:new M("=>",q),template:new M("template"),invalidTemplate:new M("invalidTemplate"),ellipsis:new M("...",q),backQuote:new M("`",z),dollarBraceL:new M("${",{beforeExpr:!0,startsExpr:!0}),eq:new M("=",{beforeExpr:!0,isAssign:!0}),assign:new M("_=",{beforeExpr:!0,isAssign:!0}),incDec:new M("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new M("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:j("||",1),logicalAND:j("&&",2),bitwiseOR:j("|",3),bitwiseXOR:j("^",4),bitwiseAND:j("&",5),equality:j("==/!=/===/!==",6),relational:j("</>/<=/>=",7),bitShift:j("<</>>/>>>",8),plusMin:new M("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:j("%",10),star:j("*",10),slash:j("/",10),starstar:new M("**",{beforeExpr:!0}),coalesce:j("??",1),_break:F("break"),_case:F("case",q),_catch:F("catch"),_continue:F("continue"),_debugger:F("debugger"),_default:F("default",q),_do:F("do",{isLoop:!0,beforeExpr:!0}),_else:F("else",q),_finally:F("finally"),_for:F("for",{isLoop:!0}),_function:F("function",z),_if:F("if"),_return:F("return",q),_switch:F("switch"),_throw:F("throw",q),_try:F("try"),_var:F("var"),_const:F("const"),_while:F("while",{isLoop:!0}),_with:F("with"),_new:F("new",{beforeExpr:!0,startsExpr:!0}),_this:F("this",z),_super:F("super",z),_class:F("class",z),_extends:F("extends",q),_export:F("export"),_import:F("import",z),_null:F("null",z),_true:F("true",z),_false:F("false",z),_in:F("in",{beforeExpr:!0,binop:7}),_instanceof:F("instanceof",{beforeExpr:!0,binop:7}),_typeof:F("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:F("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:F("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},te=/\r\n?|\n|\u2028|\u2029/,ne=new RegExp(te.source,"g");function ae(V){return V===10||V===13||V===8232||V===8233}function ge(V,se,Oe){Oe===void 0&&(Oe=V.length);for(var Le=se;Le<Oe;Le++){var Ge=V.charCodeAt(Le);if(ae(Ge))return Le<Oe-1&&Ge===13&&V.charCodeAt(Le+1)===10?Le+2:Le+1}return-1}var oe=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,je=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Ne=Object.prototype,Ae=Ne.hasOwnProperty,$e=Ne.toString,Fe=Object.hasOwn||function(V,se){return Ae.call(V,se)},ze=Array.isArray||function(V){return $e.call(V)==="[object Array]"},Ve=Object.create(null);function Be(V){return Ve[V]||(Ve[V]=new RegExp("^(?:"+V.replace(/ /g,"|")+")$"))}function qe(V){return V<=65535?String.fromCharCode(V):(V-=65536,String.fromCharCode((V>>10)+55296,(V&1023)+56320))}var Ke=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,He=function(se,Oe){this.line=se,this.column=Oe};He.prototype.offset=function(se){return new He(this.line,this.column+se)};var Xe=function(se,Oe,Le){this.start=Oe,this.end=Le,se.sourceFile!==null&&(this.source=se.sourceFile)};function tt(V,se){for(var Oe=1,Le=0;;){var Ge=ge(V,Le,se);if(Ge<0)return new He(Oe,se-Le);++Oe,Le=Ge}}var Ye={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},et=!1;function Ze(V){var se={};for(var Oe in Ye)se[Oe]=V&&Fe(V,Oe)?V[Oe]:Ye[Oe];if(se.ecmaVersion==="latest"?se.ecmaVersion=1e8:se.ecmaVersion==null?(!et&&typeof console=="object"&&console.warn&&(et=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
1049
1049
  Defaulting to 2020, but this will stop working in the future.`)),se.ecmaVersion=11):se.ecmaVersion>=2015&&(se.ecmaVersion-=2009),se.allowReserved==null&&(se.allowReserved=se.ecmaVersion<5),(!V||V.allowHashBang==null)&&(se.allowHashBang=se.ecmaVersion>=14),ze(se.onToken)){var Le=se.onToken;se.onToken=function(Ge){return Le.push(Ge)}}return ze(se.onComment)&&(se.onComment=at(se,se.onComment)),se}function at(V,se){return function(Oe,Le,Ge,ot,lt,Ct){var It={type:Oe?"Block":"Line",value:Le,start:Ge,end:ot};V.locations&&(It.loc=new Xe(this,lt,Ct)),V.ranges&&(It.range=[Ge,ot]),se.push(It)}}var rt=1,it=2,st=4,Ue=8,Rt=16,Je=32,mt=64,$t=128,Dt=256,Ht=rt|it|Dt;function Vt(V,se){return it|(V?st:0)|(se?Ue:0)}var We=0,nt=1,Qe=2,dt=3,pt=4,ft=5,ct=function(se,Oe,Le){this.options=se=Ze(se),this.sourceFile=se.sourceFile,this.keywords=Be(_[se.ecmaVersion>=6?6:se.sourceType==="module"?"5module":5]);var Ge="";se.allowReserved!==!0&&(Ge=g[se.ecmaVersion>=6?6:se.ecmaVersion===5?5:3],se.sourceType==="module"&&(Ge+=" await")),this.reservedWords=Be(Ge);var ot=(Ge?Ge+" ":"")+g.strict;this.reservedWordsStrict=Be(ot),this.reservedWordsStrictBind=Be(ot+" "+g.strictBind),this.input=String(Oe),this.containsEsc=!1,Le?(this.pos=Le,this.lineStart=this.input.lastIndexOf(`
1050
1050
  `,Le-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(te).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=O.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=se.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&se.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(rt),this.regexpState=null,this.privateNameStack=[]},qt={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};ct.prototype.parse=function(){var se=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(se)},qt.inFunction.get=function(){return(this.currentVarScope().flags&it)>0},qt.inGenerator.get=function(){return(this.currentVarScope().flags&Ue)>0&&!this.currentVarScope().inClassFieldInit},qt.inAsync.get=function(){return(this.currentVarScope().flags&st)>0&&!this.currentVarScope().inClassFieldInit},qt.canAwait.get=function(){for(var V=this.scopeStack.length-1;V>=0;V--){var se=this.scopeStack[V];if(se.inClassFieldInit||se.flags&Dt)return!1;if(se.flags&it)return(se.flags&st)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},qt.allowSuper.get=function(){var V=this.currentThisScope(),se=V.flags,Oe=V.inClassFieldInit;return(se&mt)>0||Oe||this.options.allowSuperOutsideMethod},qt.allowDirectSuper.get=function(){return(this.currentThisScope().flags&$t)>0},qt.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},qt.allowNewDotTarget.get=function(){var V=this.currentThisScope(),se=V.flags,Oe=V.inClassFieldInit;return(se&(it|Dt))>0||Oe},qt.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Dt)>0},ct.extend=function(){for(var se=[],Oe=arguments.length;Oe--;)se[Oe]=arguments[Oe];for(var Le=this,Ge=0;Ge<se.length;Ge++)Le=se[Ge](Le);return Le},ct.parse=function(se,Oe){return new this(Oe,se).parse()},ct.parseExpressionAt=function(se,Oe,Le){var Ge=new this(Le,se,Oe);return Ge.nextToken(),Ge.parseExpression()},ct.tokenizer=function(se,Oe){return new this(Oe,se)},Object.defineProperties(ct.prototype,qt);var ut=ct.prototype,Mt=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;ut.strictDirective=function(V){if(this.options.ecmaVersion<5)return!1;for(;;){je.lastIndex=V,V+=je.exec(this.input)[0].length;var se=Mt.exec(this.input.slice(V));if(!se)return!1;if((se[1]||se[2])==="use strict"){je.lastIndex=V+se[0].length;var Oe=je.exec(this.input),Le=Oe.index+Oe[0].length,Ge=this.input.charAt(Le);return Ge===";"||Ge==="}"||te.test(Oe[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(Ge)||Ge==="!"&&this.input.charAt(Le+1)==="=")}V+=se[0].length,je.lastIndex=V,V+=je.exec(this.input)[0].length,this.input[V]===";"&&V++}},ut.eat=function(V){return this.type===V?(this.next(),!0):!1},ut.isContextual=function(V){return this.type===O.name&&this.value===V&&!this.containsEsc},ut.eatContextual=function(V){return this.isContextual(V)?(this.next(),!0):!1},ut.expectContextual=function(V){this.eatContextual(V)||this.unexpected()},ut.canInsertSemicolon=function(){return this.type===O.eof||this.type===O.braceR||te.test(this.input.slice(this.lastTokEnd,this.start))},ut.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},ut.semicolon=function(){!this.eat(O.semi)&&!this.insertSemicolon()&&this.unexpected()},ut.afterTrailingComma=function(V,se){if(this.type===V)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),se||this.next(),!0},ut.expect=function(V){this.eat(V)||this.unexpected()},ut.unexpected=function(V){this.raise(V??this.start,"Unexpected token")};var Ut=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};ut.checkPatternErrors=function(V,se){if(V){V.trailingComma>-1&&this.raiseRecoverable(V.trailingComma,"Comma is not permitted after the rest element");var Oe=se?V.parenthesizedAssign:V.parenthesizedBind;Oe>-1&&this.raiseRecoverable(Oe,se?"Assigning to rvalue":"Parenthesized pattern")}},ut.checkExpressionErrors=function(V,se){if(!V)return!1;var Oe=V.shorthandAssign,Le=V.doubleProto;if(!se)return Oe>=0||Le>=0;Oe>=0&&this.raise(Oe,"Shorthand property assignments are valid only in destructuring patterns"),Le>=0&&this.raiseRecoverable(Le,"Redefinition of __proto__ property")},ut.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},ut.isSimpleAssignTarget=function(V){return V.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(V.expression):V.type==="Identifier"||V.type==="MemberExpression"};var yt=ct.prototype;yt.parseTopLevel=function(V){var se=Object.create(null);for(V.body||(V.body=[]);this.type!==O.eof;){var Oe=this.parseStatement(null,!0,se);V.body.push(Oe)}if(this.inModule)for(var Le=0,Ge=Object.keys(this.undefinedExports);Le<Ge.length;Le+=1){var ot=Ge[Le];this.raiseRecoverable(this.undefinedExports[ot].start,"Export '"+ot+"' is not defined")}return this.adaptDirectivePrologue(V.body),this.next(),V.sourceType=this.options.sourceType,this.finishNode(V,"Program")};var nr={kind:"loop"},er={kind:"switch"};yt.isLet=function(V){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;je.lastIndex=this.pos;var se=je.exec(this.input),Oe=this.pos+se[0].length,Le=this.input.charCodeAt(Oe);if(Le===91||Le===92)return!0;if(V)return!1;if(Le===123||Le>55295&&Le<56320)return!0;if(A(Le,!0)){for(var Ge=Oe+1;I(Le=this.input.charCodeAt(Ge),!0);)++Ge;if(Le===92||Le>55295&&Le<56320)return!0;var ot=this.input.slice(Oe,Ge);if(!S.test(ot))return!0}return!1},yt.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;je.lastIndex=this.pos;var V=je.exec(this.input),se=this.pos+V[0].length,Oe;return!te.test(this.input.slice(this.pos,se))&&this.input.slice(se,se+8)==="function"&&(se+8===this.input.length||!(I(Oe=this.input.charCodeAt(se+8))||Oe>55295&&Oe<56320))},yt.parseStatement=function(V,se,Oe){var Le=this.type,Ge=this.startNode(),ot;switch(this.isLet(V)&&(Le=O._var,ot="let"),Le){case O._break:case O._continue:return this.parseBreakContinueStatement(Ge,Le.keyword);case O._debugger:return this.parseDebuggerStatement(Ge);case O._do:return this.parseDoStatement(Ge);case O._for:return this.parseForStatement(Ge);case O._function:return V&&(this.strict||V!=="if"&&V!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(Ge,!1,!V);case O._class:return V&&this.unexpected(),this.parseClass(Ge,!0);case O._if:return this.parseIfStatement(Ge);case O._return:return this.parseReturnStatement(Ge);case O._switch:return this.parseSwitchStatement(Ge);case O._throw:return this.parseThrowStatement(Ge);case O._try:return this.parseTryStatement(Ge);case O._const:case O._var:return ot=ot||this.value,V&&ot!=="var"&&this.unexpected(),this.parseVarStatement(Ge,ot);case O._while:return this.parseWhileStatement(Ge);case O._with:return this.parseWithStatement(Ge);case O.braceL:return this.parseBlock(!0,Ge);case O.semi:return this.parseEmptyStatement(Ge);case O._export:case O._import:if(this.options.ecmaVersion>10&&Le===O._import){je.lastIndex=this.pos;var lt=je.exec(this.input),Ct=this.pos+lt[0].length,It=this.input.charCodeAt(Ct);if(It===40||It===46)return this.parseExpressionStatement(Ge,this.parseExpression())}return this.options.allowImportExportEverywhere||(se||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),Le===O._import?this.parseImport(Ge):this.parseExport(Ge,Oe);default:if(this.isAsyncFunction())return V&&this.unexpected(),this.next(),this.parseFunctionStatement(Ge,!0,!V);var Kt=this.value,Wt=this.parseExpression();return Le===O.name&&Wt.type==="Identifier"&&this.eat(O.colon)?this.parseLabeledStatement(Ge,Kt,Wt,V):this.parseExpressionStatement(Ge,Wt)}},yt.parseBreakContinueStatement=function(V,se){var Oe=se==="break";this.next(),this.eat(O.semi)||this.insertSemicolon()?V.label=null:this.type!==O.name?this.unexpected():(V.label=this.parseIdent(),this.semicolon());for(var Le=0;Le<this.labels.length;++Le){var Ge=this.labels[Le];if((V.label==null||Ge.name===V.label.name)&&(Ge.kind!=null&&(Oe||Ge.kind==="loop")||V.label&&Oe))break}return Le===this.labels.length&&this.raise(V.start,"Unsyntactic "+se),this.finishNode(V,Oe?"BreakStatement":"ContinueStatement")},yt.parseDebuggerStatement=function(V){return this.next(),this.semicolon(),this.finishNode(V,"DebuggerStatement")},yt.parseDoStatement=function(V){return this.next(),this.labels.push(nr),V.body=this.parseStatement("do"),this.labels.pop(),this.expect(O._while),V.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(O.semi):this.semicolon(),this.finishNode(V,"DoWhileStatement")},yt.parseForStatement=function(V){this.next();var se=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(nr),this.enterScope(0),this.expect(O.parenL),this.type===O.semi)return se>-1&&this.unexpected(se),this.parseFor(V,null);var Oe=this.isLet();if(this.type===O._var||this.type===O._const||Oe){var Le=this.startNode(),Ge=Oe?"let":this.value;return this.next(),this.parseVar(Le,!0,Ge),this.finishNode(Le,"VariableDeclaration"),(this.type===O._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&Le.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===O._in?se>-1&&this.unexpected(se):V.await=se>-1),this.parseForIn(V,Le)):(se>-1&&this.unexpected(se),this.parseFor(V,Le))}var ot=this.isContextual("let"),lt=!1,Ct=this.containsEsc,It=new Ut,Kt=this.start,Wt=se>-1?this.parseExprSubscripts(It,"await"):this.parseExpression(!0,It);return this.type===O._in||(lt=this.options.ecmaVersion>=6&&this.isContextual("of"))?(se>-1?(this.type===O._in&&this.unexpected(se),V.await=!0):lt&&this.options.ecmaVersion>=8&&(Wt.start===Kt&&!Ct&&Wt.type==="Identifier"&&Wt.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(V.await=!1)),ot&&lt&&this.raise(Wt.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(Wt,!1,It),this.checkLValPattern(Wt),this.parseForIn(V,Wt)):(this.checkExpressionErrors(It,!0),se>-1&&this.unexpected(se),this.parseFor(V,Wt))},yt.parseFunctionStatement=function(V,se,Oe){return this.next(),this.parseFunction(V,cr|(Oe?0:vr),!1,se)},yt.parseIfStatement=function(V){return this.next(),V.test=this.parseParenExpression(),V.consequent=this.parseStatement("if"),V.alternate=this.eat(O._else)?this.parseStatement("if"):null,this.finishNode(V,"IfStatement")},yt.parseReturnStatement=function(V){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(O.semi)||this.insertSemicolon()?V.argument=null:(V.argument=this.parseExpression(),this.semicolon()),this.finishNode(V,"ReturnStatement")},yt.parseSwitchStatement=function(V){this.next(),V.discriminant=this.parseParenExpression(),V.cases=[],this.expect(O.braceL),this.labels.push(er),this.enterScope(0);for(var se,Oe=!1;this.type!==O.braceR;)if(this.type===O._case||this.type===O._default){var Le=this.type===O._case;se&&this.finishNode(se,"SwitchCase"),V.cases.push(se=this.startNode()),se.consequent=[],this.next(),Le?se.test=this.parseExpression():(Oe&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),Oe=!0,se.test=null),this.expect(O.colon)}else se||this.unexpected(),se.consequent.push(this.parseStatement(null));return this.exitScope(),se&&this.finishNode(se,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(V,"SwitchStatement")},yt.parseThrowStatement=function(V){return this.next(),te.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),V.argument=this.parseExpression(),this.semicolon(),this.finishNode(V,"ThrowStatement")};var lr=[];yt.parseCatchClauseParam=function(){var V=this.parseBindingAtom(),se=V.type==="Identifier";return this.enterScope(se?Je:0),this.checkLValPattern(V,se?pt:Qe),this.expect(O.parenR),V},yt.parseTryStatement=function(V){if(this.next(),V.block=this.parseBlock(),V.handler=null,this.type===O._catch){var se=this.startNode();this.next(),this.eat(O.parenL)?se.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),se.param=null,this.enterScope(0)),se.body=this.parseBlock(!1),this.exitScope(),V.handler=this.finishNode(se,"CatchClause")}return V.finalizer=this.eat(O._finally)?this.parseBlock():null,!V.handler&&!V.finalizer&&this.raise(V.start,"Missing catch or finally clause"),this.finishNode(V,"TryStatement")},yt.parseVarStatement=function(V,se,Oe){return this.next(),this.parseVar(V,!1,se,Oe),this.semicolon(),this.finishNode(V,"VariableDeclaration")},yt.parseWhileStatement=function(V){return this.next(),V.test=this.parseParenExpression(),this.labels.push(nr),V.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(V,"WhileStatement")},yt.parseWithStatement=function(V){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),V.object=this.parseParenExpression(),V.body=this.parseStatement("with"),this.finishNode(V,"WithStatement")},yt.parseEmptyStatement=function(V){return this.next(),this.finishNode(V,"EmptyStatement")},yt.parseLabeledStatement=function(V,se,Oe,Le){for(var Ge=0,ot=this.labels;Ge<ot.length;Ge+=1){var lt=ot[Ge];lt.name===se&&this.raise(Oe.start,"Label '"+se+"' is already declared")}for(var Ct=this.type.isLoop?"loop":this.type===O._switch?"switch":null,It=this.labels.length-1;It>=0;It--){var Kt=this.labels[It];if(Kt.statementStart===V.start)Kt.statementStart=this.start,Kt.kind=Ct;else break}return this.labels.push({name:se,kind:Ct,statementStart:this.start}),V.body=this.parseStatement(Le?Le.indexOf("label")===-1?Le+"label":Le:"label"),this.labels.pop(),V.label=Oe,this.finishNode(V,"LabeledStatement")},yt.parseExpressionStatement=function(V,se){return V.expression=se,this.semicolon(),this.finishNode(V,"ExpressionStatement")},yt.parseBlock=function(V,se,Oe){for(V===void 0&&(V=!0),se===void 0&&(se=this.startNode()),se.body=[],this.expect(O.braceL),V&&this.enterScope(0);this.type!==O.braceR;){var Le=this.parseStatement(null);se.body.push(Le)}return Oe&&(this.strict=!1),this.next(),V&&this.exitScope(),this.finishNode(se,"BlockStatement")},yt.parseFor=function(V,se){return V.init=se,this.expect(O.semi),V.test=this.type===O.semi?null:this.parseExpression(),this.expect(O.semi),V.update=this.type===O.parenR?null:this.parseExpression(),this.expect(O.parenR),V.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(V,"ForStatement")},yt.parseForIn=function(V,se){var Oe=this.type===O._in;return this.next(),se.type==="VariableDeclaration"&&se.declarations[0].init!=null&&(!Oe||this.options.ecmaVersion<8||this.strict||se.kind!=="var"||se.declarations[0].id.type!=="Identifier")&&this.raise(se.start,(Oe?"for-in":"for-of")+" loop variable declaration may not have an initializer"),V.left=se,V.right=Oe?this.parseExpression():this.parseMaybeAssign(),this.expect(O.parenR),V.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(V,Oe?"ForInStatement":"ForOfStatement")},yt.parseVar=function(V,se,Oe,Le){for(V.declarations=[],V.kind=Oe;;){var Ge=this.startNode();if(this.parseVarId(Ge,Oe),this.eat(O.eq)?Ge.init=this.parseMaybeAssign(se):!Le&&Oe==="const"&&!(this.type===O._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!Le&&Ge.id.type!=="Identifier"&&!(se&&(this.type===O._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):Ge.init=null,V.declarations.push(this.finishNode(Ge,"VariableDeclarator")),!this.eat(O.comma))break}return V},yt.parseVarId=function(V,se){V.id=this.parseBindingAtom(),this.checkLValPattern(V.id,se==="var"?nt:Qe,!1)};var cr=1,vr=2,Ir=4;yt.parseFunction=function(V,se,Oe,Le,Ge){this.initFunction(V),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!Le)&&(this.type===O.star&&se&vr&&this.unexpected(),V.generator=this.eat(O.star)),this.options.ecmaVersion>=8&&(V.async=!!Le),se&cr&&(V.id=se&Ir&&this.type!==O.name?null:this.parseIdent(),V.id&&!(se&vr)&&this.checkLValSimple(V.id,this.strict||V.generator||V.async?this.treatFunctionsAsVar?nt:Qe:dt));var ot=this.yieldPos,lt=this.awaitPos,Ct=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Vt(V.async,V.generator)),se&cr||(V.id=this.type===O.name?this.parseIdent():null),this.parseFunctionParams(V),this.parseFunctionBody(V,Oe,!1,Ge),this.yieldPos=ot,this.awaitPos=lt,this.awaitIdentPos=Ct,this.finishNode(V,se&cr?"FunctionDeclaration":"FunctionExpression")},yt.parseFunctionParams=function(V){this.expect(O.parenL),V.params=this.parseBindingList(O.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},yt.parseClass=function(V,se){this.next();var Oe=this.strict;this.strict=!0,this.parseClassId(V,se),this.parseClassSuper(V);var Le=this.enterClassBody(),Ge=this.startNode(),ot=!1;for(Ge.body=[],this.expect(O.braceL);this.type!==O.braceR;){var lt=this.parseClassElement(V.superClass!==null);lt&&(Ge.body.push(lt),lt.type==="MethodDefinition"&&lt.kind==="constructor"?(ot&&this.raiseRecoverable(lt.start,"Duplicate constructor in the same class"),ot=!0):lt.key&&lt.key.type==="PrivateIdentifier"&&Nr(Le,lt)&&this.raiseRecoverable(lt.key.start,"Identifier '#"+lt.key.name+"' has already been declared"))}return this.strict=Oe,this.next(),V.body=this.finishNode(Ge,"ClassBody"),this.exitClassBody(),this.finishNode(V,se?"ClassDeclaration":"ClassExpression")},yt.parseClassElement=function(V){if(this.eat(O.semi))return null;var se=this.options.ecmaVersion,Oe=this.startNode(),Le="",Ge=!1,ot=!1,lt="method",Ct=!1;if(this.eatContextual("static")){if(se>=13&&this.eat(O.braceL))return this.parseClassStaticBlock(Oe),Oe;this.isClassElementNameStart()||this.type===O.star?Ct=!0:Le="static"}if(Oe.static=Ct,!Le&&se>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===O.star)&&!this.canInsertSemicolon()?ot=!0:Le="async"),!Le&&(se>=9||!ot)&&this.eat(O.star)&&(Ge=!0),!Le&&!ot&&!Ge){var It=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?lt=It:Le=It)}if(Le?(Oe.computed=!1,Oe.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Oe.key.name=Le,this.finishNode(Oe.key,"Identifier")):this.parseClassElementName(Oe),se<13||this.type===O.parenL||lt!=="method"||Ge||ot){var Kt=!Oe.static&&Mr(Oe,"constructor"),Wt=Kt&&V;Kt&&lt!=="method"&&this.raise(Oe.key.start,"Constructor can't have get/set modifier"),Oe.kind=Kt?"constructor":lt,this.parseClassMethod(Oe,Ge,ot,Wt)}else this.parseClassField(Oe);return Oe},yt.isClassElementNameStart=function(){return this.type===O.name||this.type===O.privateId||this.type===O.num||this.type===O.string||this.type===O.bracketL||this.type.keyword},yt.parseClassElementName=function(V){this.type===O.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),V.computed=!1,V.key=this.parsePrivateIdent()):this.parsePropertyName(V)},yt.parseClassMethod=function(V,se,Oe,Le){var Ge=V.key;V.kind==="constructor"?(se&&this.raise(Ge.start,"Constructor can't be a generator"),Oe&&this.raise(Ge.start,"Constructor can't be an async method")):V.static&&Mr(V,"prototype")&&this.raise(Ge.start,"Classes may not have a static property named prototype");var ot=V.value=this.parseMethod(se,Oe,Le);return V.kind==="get"&&ot.params.length!==0&&this.raiseRecoverable(ot.start,"getter should have no params"),V.kind==="set"&&ot.params.length!==1&&this.raiseRecoverable(ot.start,"setter should have exactly one param"),V.kind==="set"&&ot.params[0].type==="RestElement"&&this.raiseRecoverable(ot.params[0].start,"Setter cannot use rest params"),this.finishNode(V,"MethodDefinition")},yt.parseClassField=function(V){if(Mr(V,"constructor")?this.raise(V.key.start,"Classes can't have a field named 'constructor'"):V.static&&Mr(V,"prototype")&&this.raise(V.key.start,"Classes can't have a static field named 'prototype'"),this.eat(O.eq)){var se=this.currentThisScope(),Oe=se.inClassFieldInit;se.inClassFieldInit=!0,V.value=this.parseMaybeAssign(),se.inClassFieldInit=Oe}else V.value=null;return this.semicolon(),this.finishNode(V,"PropertyDefinition")},yt.parseClassStaticBlock=function(V){V.body=[];var se=this.labels;for(this.labels=[],this.enterScope(Dt|mt);this.type!==O.braceR;){var Oe=this.parseStatement(null);V.body.push(Oe)}return this.next(),this.exitScope(),this.labels=se,this.finishNode(V,"StaticBlock")},yt.parseClassId=function(V,se){this.type===O.name?(V.id=this.parseIdent(),se&&this.checkLValSimple(V.id,Qe,!1)):(se===!0&&this.unexpected(),V.id=null)},yt.parseClassSuper=function(V){V.superClass=this.eat(O._extends)?this.parseExprSubscripts(null,!1):null},yt.enterClassBody=function(){var V={declared:Object.create(null),used:[]};return this.privateNameStack.push(V),V.declared},yt.exitClassBody=function(){var V=this.privateNameStack.pop(),se=V.declared,Oe=V.used;if(this.options.checkPrivateFields)for(var Le=this.privateNameStack.length,Ge=Le===0?null:this.privateNameStack[Le-1],ot=0;ot<Oe.length;++ot){var lt=Oe[ot];Fe(se,lt.name)||(Ge?Ge.used.push(lt):this.raiseRecoverable(lt.start,"Private field '#"+lt.name+"' must be declared in an enclosing class"))}};function Nr(V,se){var Oe=se.key.name,Le=V[Oe],Ge="true";return se.type==="MethodDefinition"&&(se.kind==="get"||se.kind==="set")&&(Ge=(se.static?"s":"i")+se.kind),Le==="iget"&&Ge==="iset"||Le==="iset"&&Ge==="iget"||Le==="sget"&&Ge==="sset"||Le==="sset"&&Ge==="sget"?(V[Oe]="true",!1):Le?!0:(V[Oe]=Ge,!1)}function Mr(V,se){var Oe=V.computed,Le=V.key;return!Oe&&(Le.type==="Identifier"&&Le.name===se||Le.type==="Literal"&&Le.value===se)}yt.parseExportAllDeclaration=function(V,se){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(V.exported=this.parseModuleExportName(),this.checkExport(se,V.exported,this.lastTokStart)):V.exported=null),this.expectContextual("from"),this.type!==O.string&&this.unexpected(),V.source=this.parseExprAtom(),this.semicolon(),this.finishNode(V,"ExportAllDeclaration")},yt.parseExport=function(V,se){if(this.next(),this.eat(O.star))return this.parseExportAllDeclaration(V,se);if(this.eat(O._default))return this.checkExport(se,"default",this.lastTokStart),V.declaration=this.parseExportDefaultDeclaration(),this.finishNode(V,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())V.declaration=this.parseExportDeclaration(V),V.declaration.type==="VariableDeclaration"?this.checkVariableExport(se,V.declaration.declarations):this.checkExport(se,V.declaration.id,V.declaration.id.start),V.specifiers=[],V.source=null;else{if(V.declaration=null,V.specifiers=this.parseExportSpecifiers(se),this.eatContextual("from"))this.type!==O.string&&this.unexpected(),V.source=this.parseExprAtom();else{for(var Oe=0,Le=V.specifiers;Oe<Le.length;Oe+=1){var Ge=Le[Oe];this.checkUnreserved(Ge.local),this.checkLocalExport(Ge.local),Ge.local.type==="Literal"&&this.raise(Ge.local.start,"A string literal cannot be used as an exported binding without `from`.")}V.source=null}this.semicolon()}return this.finishNode(V,"ExportNamedDeclaration")},yt.parseExportDeclaration=function(V){return this.parseStatement(null)},yt.parseExportDefaultDeclaration=function(){var V;if(this.type===O._function||(V=this.isAsyncFunction())){var se=this.startNode();return this.next(),V&&this.next(),this.parseFunction(se,cr|Ir,!1,V)}else if(this.type===O._class){var Oe=this.startNode();return this.parseClass(Oe,"nullableID")}else{var Le=this.parseMaybeAssign();return this.semicolon(),Le}},yt.checkExport=function(V,se,Oe){V&&(typeof se!="string"&&(se=se.type==="Identifier"?se.name:se.value),Fe(V,se)&&this.raiseRecoverable(Oe,"Duplicate export '"+se+"'"),V[se]=!0)},yt.checkPatternExport=function(V,se){var Oe=se.type;if(Oe==="Identifier")this.checkExport(V,se,se.start);else if(Oe==="ObjectPattern")for(var Le=0,Ge=se.properties;Le<Ge.length;Le+=1){var ot=Ge[Le];this.checkPatternExport(V,ot)}else if(Oe==="ArrayPattern")for(var lt=0,Ct=se.elements;lt<Ct.length;lt+=1){var It=Ct[lt];It&&this.checkPatternExport(V,It)}else Oe==="Property"?this.checkPatternExport(V,se.value):Oe==="AssignmentPattern"?this.checkPatternExport(V,se.left):Oe==="RestElement"&&this.checkPatternExport(V,se.argument)},yt.checkVariableExport=function(V,se){if(V)for(var Oe=0,Le=se;Oe<Le.length;Oe+=1){var Ge=Le[Oe];this.checkPatternExport(V,Ge.id)}},yt.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},yt.parseExportSpecifier=function(V){var se=this.startNode();return se.local=this.parseModuleExportName(),se.exported=this.eatContextual("as")?this.parseModuleExportName():se.local,this.checkExport(V,se.exported,se.exported.start),this.finishNode(se,"ExportSpecifier")},yt.parseExportSpecifiers=function(V){var se=[],Oe=!0;for(this.expect(O.braceL);!this.eat(O.braceR);){if(Oe)Oe=!1;else if(this.expect(O.comma),this.afterTrailingComma(O.braceR))break;se.push(this.parseExportSpecifier(V))}return se},yt.parseImport=function(V){return this.next(),this.type===O.string?(V.specifiers=lr,V.source=this.parseExprAtom()):(V.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),V.source=this.type===O.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(V,"ImportDeclaration")},yt.parseImportSpecifier=function(){var V=this.startNode();return V.imported=this.parseModuleExportName(),this.eatContextual("as")?V.local=this.parseIdent():(this.checkUnreserved(V.imported),V.local=V.imported),this.checkLValSimple(V.local,Qe),this.finishNode(V,"ImportSpecifier")},yt.parseImportDefaultSpecifier=function(){var V=this.startNode();return V.local=this.parseIdent(),this.checkLValSimple(V.local,Qe),this.finishNode(V,"ImportDefaultSpecifier")},yt.parseImportNamespaceSpecifier=function(){var V=this.startNode();return this.next(),this.expectContextual("as"),V.local=this.parseIdent(),this.checkLValSimple(V.local,Qe),this.finishNode(V,"ImportNamespaceSpecifier")},yt.parseImportSpecifiers=function(){var V=[],se=!0;if(this.type===O.name&&(V.push(this.parseImportDefaultSpecifier()),!this.eat(O.comma)))return V;if(this.type===O.star)return V.push(this.parseImportNamespaceSpecifier()),V;for(this.expect(O.braceL);!this.eat(O.braceR);){if(se)se=!1;else if(this.expect(O.comma),this.afterTrailingComma(O.braceR))break;V.push(this.parseImportSpecifier())}return V},yt.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===O.string){var V=this.parseLiteral(this.value);return Ke.test(V.value)&&this.raise(V.start,"An export name cannot include a lone surrogate."),V}return this.parseIdent(!0)},yt.adaptDirectivePrologue=function(V){for(var se=0;se<V.length&&this.isDirectiveCandidate(V[se]);++se)V[se].directive=V[se].expression.raw.slice(1,-1)},yt.isDirectiveCandidate=function(V){return this.options.ecmaVersion>=5&&V.type==="ExpressionStatement"&&V.expression.type==="Literal"&&typeof V.expression.value=="string"&&(this.input[V.start]==='"'||this.input[V.start]==="'")};var ar=ct.prototype;ar.toAssignable=function(V,se,Oe){if(this.options.ecmaVersion>=6&&V)switch(V.type){case"Identifier":this.inAsync&&V.name==="await"&&this.raise(V.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":V.type="ObjectPattern",Oe&&this.checkPatternErrors(Oe,!0);for(var Le=0,Ge=V.properties;Le<Ge.length;Le+=1){var ot=Ge[Le];this.toAssignable(ot,se),ot.type==="RestElement"&&(ot.argument.type==="ArrayPattern"||ot.argument.type==="ObjectPattern")&&this.raise(ot.argument.start,"Unexpected token")}break;case"Property":V.kind!=="init"&&this.raise(V.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(V.value,se);break;case"ArrayExpression":V.type="ArrayPattern",Oe&&this.checkPatternErrors(Oe,!0),this.toAssignableList(V.elements,se);break;case"SpreadElement":V.type="RestElement",this.toAssignable(V.argument,se),V.argument.type==="AssignmentPattern"&&this.raise(V.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":V.operator!=="="&&this.raise(V.left.end,"Only '=' operator can be used for specifying default value."),V.type="AssignmentPattern",delete V.operator,this.toAssignable(V.left,se);break;case"ParenthesizedExpression":this.toAssignable(V.expression,se,Oe);break;case"ChainExpression":this.raiseRecoverable(V.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!se)break;default:this.raise(V.start,"Assigning to rvalue")}else Oe&&this.checkPatternErrors(Oe,!0);return V},ar.toAssignableList=function(V,se){for(var Oe=V.length,Le=0;Le<Oe;Le++){var Ge=V[Le];Ge&&this.toAssignable(Ge,se)}if(Oe){var ot=V[Oe-1];this.options.ecmaVersion===6&&se&&ot&&ot.type==="RestElement"&&ot.argument.type!=="Identifier"&&this.unexpected(ot.argument.start)}return V},ar.parseSpread=function(V){var se=this.startNode();return this.next(),se.argument=this.parseMaybeAssign(!1,V),this.finishNode(se,"SpreadElement")},ar.parseRestBinding=function(){var V=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==O.name&&this.unexpected(),V.argument=this.parseBindingAtom(),this.finishNode(V,"RestElement")},ar.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case O.bracketL:var V=this.startNode();return this.next(),V.elements=this.parseBindingList(O.bracketR,!0,!0),this.finishNode(V,"ArrayPattern");case O.braceL:return this.parseObj(!0)}return this.parseIdent()},ar.parseBindingList=function(V,se,Oe,Le){for(var Ge=[],ot=!0;!this.eat(V);)if(ot?ot=!1:this.expect(O.comma),se&&this.type===O.comma)Ge.push(null);else{if(Oe&&this.afterTrailingComma(V))break;if(this.type===O.ellipsis){var lt=this.parseRestBinding();this.parseBindingListItem(lt),Ge.push(lt),this.type===O.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(V);break}else Ge.push(this.parseAssignableListItem(Le))}return Ge},ar.parseAssignableListItem=function(V){var se=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(se),se},ar.parseBindingListItem=function(V){return V},ar.parseMaybeDefault=function(V,se,Oe){if(Oe=Oe||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(O.eq))return Oe;var Le=this.startNodeAt(V,se);return Le.left=Oe,Le.right=this.parseMaybeAssign(),this.finishNode(Le,"AssignmentPattern")},ar.checkLValSimple=function(V,se,Oe){se===void 0&&(se=We);var Le=se!==We;switch(V.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(V.name)&&this.raiseRecoverable(V.start,(Le?"Binding ":"Assigning to ")+V.name+" in strict mode"),Le&&(se===Qe&&V.name==="let"&&this.raiseRecoverable(V.start,"let is disallowed as a lexically bound name"),Oe&&(Fe(Oe,V.name)&&this.raiseRecoverable(V.start,"Argument name clash"),Oe[V.name]=!0),se!==ft&&this.declareName(V.name,se,V.start));break;case"ChainExpression":this.raiseRecoverable(V.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":Le&&this.raiseRecoverable(V.start,"Binding member expression");break;case"ParenthesizedExpression":return Le&&this.raiseRecoverable(V.start,"Binding parenthesized expression"),this.checkLValSimple(V.expression,se,Oe);default:this.raise(V.start,(Le?"Binding":"Assigning to")+" rvalue")}},ar.checkLValPattern=function(V,se,Oe){switch(se===void 0&&(se=We),V.type){case"ObjectPattern":for(var Le=0,Ge=V.properties;Le<Ge.length;Le+=1){var ot=Ge[Le];this.checkLValInnerPattern(ot,se,Oe)}break;case"ArrayPattern":for(var lt=0,Ct=V.elements;lt<Ct.length;lt+=1){var It=Ct[lt];It&&this.checkLValInnerPattern(It,se,Oe)}break;default:this.checkLValSimple(V,se,Oe)}},ar.checkLValInnerPattern=function(V,se,Oe){switch(se===void 0&&(se=We),V.type){case"Property":this.checkLValInnerPattern(V.value,se,Oe);break;case"AssignmentPattern":this.checkLValPattern(V.left,se,Oe);break;case"RestElement":this.checkLValPattern(V.argument,se,Oe);break;default:this.checkLValPattern(V,se,Oe)}};var sr=function(se,Oe,Le,Ge,ot){this.token=se,this.isExpr=!!Oe,this.preserveSpace=!!Le,this.override=Ge,this.generator=!!ot},rr={b_stat:new sr("{",!1),b_expr:new sr("{",!0),b_tmpl:new sr("${",!1),p_stat:new sr("(",!1),p_expr:new sr("(",!0),q_tmpl:new sr("`",!0,!0,function(V){return V.tryReadTemplateToken()}),f_stat:new sr("function",!1),f_expr:new sr("function",!0),f_expr_gen:new sr("function",!0,!1,null,!0),f_gen:new sr("function",!1,!1,null,!0)},xr=ct.prototype;xr.initialContext=function(){return[rr.b_stat]},xr.curContext=function(){return this.context[this.context.length-1]},xr.braceIsBlock=function(V){var se=this.curContext();return se===rr.f_expr||se===rr.f_stat?!0:V===O.colon&&(se===rr.b_stat||se===rr.b_expr)?!se.isExpr:V===O._return||V===O.name&&this.exprAllowed?te.test(this.input.slice(this.lastTokEnd,this.start)):V===O._else||V===O.semi||V===O.eof||V===O.parenR||V===O.arrow?!0:V===O.braceL?se===rr.b_stat:V===O._var||V===O._const||V===O.name?!1:!this.exprAllowed},xr.inGeneratorContext=function(){for(var V=this.context.length-1;V>=1;V--){var se=this.context[V];if(se.token==="function")return se.generator}return!1},xr.updateContext=function(V){var se,Oe=this.type;Oe.keyword&&V===O.dot?this.exprAllowed=!1:(se=Oe.updateContext)?se.call(this,V):this.exprAllowed=Oe.beforeExpr},xr.overrideContext=function(V){this.curContext()!==V&&(this.context[this.context.length-1]=V)},O.parenR.updateContext=O.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var V=this.context.pop();V===rr.b_stat&&this.curContext().token==="function"&&(V=this.context.pop()),this.exprAllowed=!V.isExpr},O.braceL.updateContext=function(V){this.context.push(this.braceIsBlock(V)?rr.b_stat:rr.b_expr),this.exprAllowed=!0},O.dollarBraceL.updateContext=function(){this.context.push(rr.b_tmpl),this.exprAllowed=!0},O.parenL.updateContext=function(V){var se=V===O._if||V===O._for||V===O._with||V===O._while;this.context.push(se?rr.p_stat:rr.p_expr),this.exprAllowed=!0},O.incDec.updateContext=function(){},O._function.updateContext=O._class.updateContext=function(V){V.beforeExpr&&V!==O._else&&!(V===O.semi&&this.curContext()!==rr.p_stat)&&!(V===O._return&&te.test(this.input.slice(this.lastTokEnd,this.start)))&&!((V===O.colon||V===O.braceL)&&this.curContext()===rr.b_stat)?this.context.push(rr.f_expr):this.context.push(rr.f_stat),this.exprAllowed=!1},O.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0},O.backQuote.updateContext=function(){this.curContext()===rr.q_tmpl?this.context.pop():this.context.push(rr.q_tmpl),this.exprAllowed=!1},O.star.updateContext=function(V){if(V===O._function){var se=this.context.length-1;this.context[se]===rr.f_expr?this.context[se]=rr.f_expr_gen:this.context[se]=rr.f_gen}this.exprAllowed=!0},O.name.updateContext=function(V){var se=!1;this.options.ecmaVersion>=6&&V!==O.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(se=!0),this.exprAllowed=se};var zt=ct.prototype;zt.checkPropClash=function(V,se,Oe){if(!(this.options.ecmaVersion>=9&&V.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(V.computed||V.method||V.shorthand))){var Le=V.key,Ge;switch(Le.type){case"Identifier":Ge=Le.name;break;case"Literal":Ge=String(Le.value);break;default:return}var ot=V.kind;if(this.options.ecmaVersion>=6){Ge==="__proto__"&&ot==="init"&&(se.proto&&(Oe?Oe.doubleProto<0&&(Oe.doubleProto=Le.start):this.raiseRecoverable(Le.start,"Redefinition of __proto__ property")),se.proto=!0);return}Ge="$"+Ge;var lt=se[Ge];if(lt){var Ct;ot==="init"?Ct=this.strict&&lt.init||lt.get||lt.set:Ct=lt.init||lt[ot],Ct&&this.raiseRecoverable(Le.start,"Redefinition of property")}else lt=se[Ge]={init:!1,get:!1,set:!1};lt[ot]=!0}},zt.parseExpression=function(V,se){var Oe=this.start,Le=this.startLoc,Ge=this.parseMaybeAssign(V,se);if(this.type===O.comma){var ot=this.startNodeAt(Oe,Le);for(ot.expressions=[Ge];this.eat(O.comma);)ot.expressions.push(this.parseMaybeAssign(V,se));return this.finishNode(ot,"SequenceExpression")}return Ge},zt.parseMaybeAssign=function(V,se,Oe){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(V);this.exprAllowed=!1}var Le=!1,Ge=-1,ot=-1,lt=-1;se?(Ge=se.parenthesizedAssign,ot=se.trailingComma,lt=se.doubleProto,se.parenthesizedAssign=se.trailingComma=-1):(se=new Ut,Le=!0);var Ct=this.start,It=this.startLoc;(this.type===O.parenL||this.type===O.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=V==="await");var Kt=this.parseMaybeConditional(V,se);if(Oe&&(Kt=Oe.call(this,Kt,Ct,It)),this.type.isAssign){var Wt=this.startNodeAt(Ct,It);return Wt.operator=this.value,this.type===O.eq&&(Kt=this.toAssignable(Kt,!1,se)),Le||(se.parenthesizedAssign=se.trailingComma=se.doubleProto=-1),se.shorthandAssign>=Kt.start&&(se.shorthandAssign=-1),this.type===O.eq?this.checkLValPattern(Kt):this.checkLValSimple(Kt),Wt.left=Kt,this.next(),Wt.right=this.parseMaybeAssign(V),lt>-1&&(se.doubleProto=lt),this.finishNode(Wt,"AssignmentExpression")}else Le&&this.checkExpressionErrors(se,!0);return Ge>-1&&(se.parenthesizedAssign=Ge),ot>-1&&(se.trailingComma=ot),Kt},zt.parseMaybeConditional=function(V,se){var Oe=this.start,Le=this.startLoc,Ge=this.parseExprOps(V,se);if(this.checkExpressionErrors(se))return Ge;if(this.eat(O.question)){var ot=this.startNodeAt(Oe,Le);return ot.test=Ge,ot.consequent=this.parseMaybeAssign(),this.expect(O.colon),ot.alternate=this.parseMaybeAssign(V),this.finishNode(ot,"ConditionalExpression")}return Ge},zt.parseExprOps=function(V,se){var Oe=this.start,Le=this.startLoc,Ge=this.parseMaybeUnary(se,!1,!1,V);return this.checkExpressionErrors(se)||Ge.start===Oe&&Ge.type==="ArrowFunctionExpression"?Ge:this.parseExprOp(Ge,Oe,Le,-1,V)},zt.parseExprOp=function(V,se,Oe,Le,Ge){var ot=this.type.binop;if(ot!=null&&(!Ge||this.type!==O._in)&&ot>Le){var lt=this.type===O.logicalOR||this.type===O.logicalAND,Ct=this.type===O.coalesce;Ct&&(ot=O.logicalAND.binop);var It=this.value;this.next();var Kt=this.start,Wt=this.startLoc,ir=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,Ge),Kt,Wt,ot,Ge),mr=this.buildBinary(se,Oe,V,ir,It,lt||Ct);return(lt&&this.type===O.coalesce||Ct&&(this.type===O.logicalOR||this.type===O.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(mr,se,Oe,Le,Ge)}return V},zt.buildBinary=function(V,se,Oe,Le,Ge,ot){Le.type==="PrivateIdentifier"&&this.raise(Le.start,"Private identifier can only be left side of binary expression");var lt=this.startNodeAt(V,se);return lt.left=Oe,lt.operator=Ge,lt.right=Le,this.finishNode(lt,ot?"LogicalExpression":"BinaryExpression")},zt.parseMaybeUnary=function(V,se,Oe,Le){var Ge=this.start,ot=this.startLoc,lt;if(this.isContextual("await")&&this.canAwait)lt=this.parseAwait(Le),se=!0;else if(this.type.prefix){var Ct=this.startNode(),It=this.type===O.incDec;Ct.operator=this.value,Ct.prefix=!0,this.next(),Ct.argument=this.parseMaybeUnary(null,!0,It,Le),this.checkExpressionErrors(V,!0),It?this.checkLValSimple(Ct.argument):this.strict&&Ct.operator==="delete"&&Wr(Ct.argument)?this.raiseRecoverable(Ct.start,"Deleting local variable in strict mode"):Ct.operator==="delete"&&Br(Ct.argument)?this.raiseRecoverable(Ct.start,"Private fields can not be deleted"):se=!0,lt=this.finishNode(Ct,It?"UpdateExpression":"UnaryExpression")}else if(!se&&this.type===O.privateId)(Le||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),lt=this.parsePrivateIdent(),this.type!==O._in&&this.unexpected();else{if(lt=this.parseExprSubscripts(V,Le),this.checkExpressionErrors(V))return lt;for(;this.type.postfix&&!this.canInsertSemicolon();){var Kt=this.startNodeAt(Ge,ot);Kt.operator=this.value,Kt.prefix=!1,Kt.argument=lt,this.checkLValSimple(lt),this.next(),lt=this.finishNode(Kt,"UpdateExpression")}}if(!Oe&&this.eat(O.starstar))if(se)this.unexpected(this.lastTokStart);else return this.buildBinary(Ge,ot,lt,this.parseMaybeUnary(null,!1,!1,Le),"**",!1);else return lt};function Wr(V){return V.type==="Identifier"||V.type==="ParenthesizedExpression"&&Wr(V.expression)}function Br(V){return V.type==="MemberExpression"&&V.property.type==="PrivateIdentifier"||V.type==="ChainExpression"&&Br(V.expression)||V.type==="ParenthesizedExpression"&&Br(V.expression)}zt.parseExprSubscripts=function(V,se){var Oe=this.start,Le=this.startLoc,Ge=this.parseExprAtom(V,se);if(Ge.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return Ge;var ot=this.parseSubscripts(Ge,Oe,Le,!1,se);return V&&ot.type==="MemberExpression"&&(V.parenthesizedAssign>=ot.start&&(V.parenthesizedAssign=-1),V.parenthesizedBind>=ot.start&&(V.parenthesizedBind=-1),V.trailingComma>=ot.start&&(V.trailingComma=-1)),ot},zt.parseSubscripts=function(V,se,Oe,Le,Ge){for(var ot=this.options.ecmaVersion>=8&&V.type==="Identifier"&&V.name==="async"&&this.lastTokEnd===V.end&&!this.canInsertSemicolon()&&V.end-V.start===5&&this.potentialArrowAt===V.start,lt=!1;;){var Ct=this.parseSubscript(V,se,Oe,Le,ot,lt,Ge);if(Ct.optional&&(lt=!0),Ct===V||Ct.type==="ArrowFunctionExpression"){if(lt){var It=this.startNodeAt(se,Oe);It.expression=Ct,Ct=this.finishNode(It,"ChainExpression")}return Ct}V=Ct}},zt.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(O.arrow)},zt.parseSubscriptAsyncArrow=function(V,se,Oe,Le){return this.parseArrowExpression(this.startNodeAt(V,se),Oe,!0,Le)},zt.parseSubscript=function(V,se,Oe,Le,Ge,ot,lt){var Ct=this.options.ecmaVersion>=11,It=Ct&&this.eat(O.questionDot);Le&&It&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var Kt=this.eat(O.bracketL);if(Kt||It&&this.type!==O.parenL&&this.type!==O.backQuote||this.eat(O.dot)){var Wt=this.startNodeAt(se,Oe);Wt.object=V,Kt?(Wt.property=this.parseExpression(),this.expect(O.bracketR)):this.type===O.privateId&&V.type!=="Super"?Wt.property=this.parsePrivateIdent():Wt.property=this.parseIdent(this.options.allowReserved!=="never"),Wt.computed=!!Kt,Ct&&(Wt.optional=It),V=this.finishNode(Wt,"MemberExpression")}else if(!Le&&this.eat(O.parenL)){var ir=new Ut,mr=this.yieldPos,Tr=this.awaitPos,_r=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var Dr=this.parseExprList(O.parenR,this.options.ecmaVersion>=8,!1,ir);if(Ge&&!It&&this.shouldParseAsyncArrow())return this.checkPatternErrors(ir,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=mr,this.awaitPos=Tr,this.awaitIdentPos=_r,this.parseSubscriptAsyncArrow(se,Oe,Dr,lt);this.checkExpressionErrors(ir,!0),this.yieldPos=mr||this.yieldPos,this.awaitPos=Tr||this.awaitPos,this.awaitIdentPos=_r||this.awaitIdentPos;var Sr=this.startNodeAt(se,Oe);Sr.callee=V,Sr.arguments=Dr,Ct&&(Sr.optional=It),V=this.finishNode(Sr,"CallExpression")}else if(this.type===O.backQuote){(It||ot)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var Rr=this.startNodeAt(se,Oe);Rr.tag=V,Rr.quasi=this.parseTemplate({isTagged:!0}),V=this.finishNode(Rr,"TaggedTemplateExpression")}return V},zt.parseExprAtom=function(V,se,Oe){this.type===O.slash&&this.readRegexp();var Le,Ge=this.potentialArrowAt===this.start;switch(this.type){case O._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),Le=this.startNode(),this.next(),this.type===O.parenL&&!this.allowDirectSuper&&this.raise(Le.start,"super() call outside constructor of a subclass"),this.type!==O.dot&&this.type!==O.bracketL&&this.type!==O.parenL&&this.unexpected(),this.finishNode(Le,"Super");case O._this:return Le=this.startNode(),this.next(),this.finishNode(Le,"ThisExpression");case O.name:var ot=this.start,lt=this.startLoc,Ct=this.containsEsc,It=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!Ct&&It.name==="async"&&!this.canInsertSemicolon()&&this.eat(O._function))return this.overrideContext(rr.f_expr),this.parseFunction(this.startNodeAt(ot,lt),0,!1,!0,se);if(Ge&&!this.canInsertSemicolon()){if(this.eat(O.arrow))return this.parseArrowExpression(this.startNodeAt(ot,lt),[It],!1,se);if(this.options.ecmaVersion>=8&&It.name==="async"&&this.type===O.name&&!Ct&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return It=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(O.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(ot,lt),[It],!0,se)}return It;case O.regexp:var Kt=this.value;return Le=this.parseLiteral(Kt.value),Le.regex={pattern:Kt.pattern,flags:Kt.flags},Le;case O.num:case O.string:return this.parseLiteral(this.value);case O._null:case O._true:case O._false:return Le=this.startNode(),Le.value=this.type===O._null?null:this.type===O._true,Le.raw=this.type.keyword,this.next(),this.finishNode(Le,"Literal");case O.parenL:var Wt=this.start,ir=this.parseParenAndDistinguishExpression(Ge,se);return V&&(V.parenthesizedAssign<0&&!this.isSimpleAssignTarget(ir)&&(V.parenthesizedAssign=Wt),V.parenthesizedBind<0&&(V.parenthesizedBind=Wt)),ir;case O.bracketL:return Le=this.startNode(),this.next(),Le.elements=this.parseExprList(O.bracketR,!0,!0,V),this.finishNode(Le,"ArrayExpression");case O.braceL:return this.overrideContext(rr.b_expr),this.parseObj(!1,V);case O._function:return Le=this.startNode(),this.next(),this.parseFunction(Le,0);case O._class:return this.parseClass(this.startNode(),!1);case O._new:return this.parseNew();case O.backQuote:return this.parseTemplate();case O._import:return this.options.ecmaVersion>=11?this.parseExprImport(Oe):this.unexpected();default:return this.parseExprAtomDefault()}},zt.parseExprAtomDefault=function(){this.unexpected()},zt.parseExprImport=function(V){var se=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===O.parenL&&!V)return this.parseDynamicImport(se);if(this.type===O.dot){var Oe=this.startNodeAt(se.start,se.loc&&se.loc.start);return Oe.name="import",se.meta=this.finishNode(Oe,"Identifier"),this.parseImportMeta(se)}else this.unexpected()},zt.parseDynamicImport=function(V){if(this.next(),V.source=this.parseMaybeAssign(),!this.eat(O.parenR)){var se=this.start;this.eat(O.comma)&&this.eat(O.parenR)?this.raiseRecoverable(se,"Trailing comma is not allowed in import()"):this.unexpected(se)}return this.finishNode(V,"ImportExpression")},zt.parseImportMeta=function(V){this.next();var se=this.containsEsc;return V.property=this.parseIdent(!0),V.property.name!=="meta"&&this.raiseRecoverable(V.property.start,"The only valid meta property for import is 'import.meta'"),se&&this.raiseRecoverable(V.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(V.start,"Cannot use 'import.meta' outside a module"),this.finishNode(V,"MetaProperty")},zt.parseLiteral=function(V){var se=this.startNode();return se.value=V,se.raw=this.input.slice(this.start,this.end),se.raw.charCodeAt(se.raw.length-1)===110&&(se.bigint=se.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(se,"Literal")},zt.parseParenExpression=function(){this.expect(O.parenL);var V=this.parseExpression();return this.expect(O.parenR),V},zt.shouldParseArrow=function(V){return!this.canInsertSemicolon()},zt.parseParenAndDistinguishExpression=function(V,se){var Oe=this.start,Le=this.startLoc,Ge,ot=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var lt=this.start,Ct=this.startLoc,It=[],Kt=!0,Wt=!1,ir=new Ut,mr=this.yieldPos,Tr=this.awaitPos,_r;for(this.yieldPos=0,this.awaitPos=0;this.type!==O.parenR;)if(Kt?Kt=!1:this.expect(O.comma),ot&&this.afterTrailingComma(O.parenR,!0)){Wt=!0;break}else if(this.type===O.ellipsis){_r=this.start,It.push(this.parseParenItem(this.parseRestBinding())),this.type===O.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else It.push(this.parseMaybeAssign(!1,ir,this.parseParenItem));var Dr=this.lastTokEnd,Sr=this.lastTokEndLoc;if(this.expect(O.parenR),V&&this.shouldParseArrow(It)&&this.eat(O.arrow))return this.checkPatternErrors(ir,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=mr,this.awaitPos=Tr,this.parseParenArrowList(Oe,Le,It,se);(!It.length||Wt)&&this.unexpected(this.lastTokStart),_r&&this.unexpected(_r),this.checkExpressionErrors(ir,!0),this.yieldPos=mr||this.yieldPos,this.awaitPos=Tr||this.awaitPos,It.length>1?(Ge=this.startNodeAt(lt,Ct),Ge.expressions=It,this.finishNodeAt(Ge,"SequenceExpression",Dr,Sr)):Ge=It[0]}else Ge=this.parseParenExpression();if(this.options.preserveParens){var Rr=this.startNodeAt(Oe,Le);return Rr.expression=Ge,this.finishNode(Rr,"ParenthesizedExpression")}else return Ge},zt.parseParenItem=function(V){return V},zt.parseParenArrowList=function(V,se,Oe,Le){return this.parseArrowExpression(this.startNodeAt(V,se),Oe,!1,Le)};var Rn=[];zt.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var V=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===O.dot){var se=this.startNodeAt(V.start,V.loc&&V.loc.start);se.name="new",V.meta=this.finishNode(se,"Identifier"),this.next();var Oe=this.containsEsc;return V.property=this.parseIdent(!0),V.property.name!=="target"&&this.raiseRecoverable(V.property.start,"The only valid meta property for new is 'new.target'"),Oe&&this.raiseRecoverable(V.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(V.start,"'new.target' can only be used in functions and class static block"),this.finishNode(V,"MetaProperty")}var Le=this.start,Ge=this.startLoc;return V.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),Le,Ge,!0,!1),this.eat(O.parenL)?V.arguments=this.parseExprList(O.parenR,this.options.ecmaVersion>=8,!1):V.arguments=Rn,this.finishNode(V,"NewExpression")},zt.parseTemplateElement=function(V){var se=V.isTagged,Oe=this.startNode();return this.type===O.invalidTemplate?(se||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),Oe.value={raw:this.value.replace(/\r\n?/g,`
1051
1051
  `),cooked:null}):Oe.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
@@ -1063,9 +1063,9 @@ Defaulting to 2020, but this will stop working in the future.`)),e.ecmaVersion=1
1063
1063
  `;break;default:t+=String.fromCharCode(n);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),e=this.pos}else++this.pos}},pp.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(types$1.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
1064
1064
  `&&++this.pos;case`
1065
1065
  `:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")},pp.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.pos);switch(++this.pos,e){case 110:return`
1066
- `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return codePointToString(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),t){var n=this.pos-1;this.invalidStringToken(n,"Invalid escape sequence in template string")}default:if(e>=48&&e<=55){var o=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],l=parseInt(o,8);return l>255&&(o=o.slice(0,-1),l=parseInt(o,8)),this.pos+=o.length-1,e=this.input.charCodeAt(this.pos),(o!=="0"||e===56||e===57)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-o.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(l)}return isNewLine(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}},pp.readHexChar=function(t){var e=this.pos,n=this.readInt(16,t);return n===null&&this.invalidStringToken(e,"Bad character escape sequence"),n},pp.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,n=this.pos,o=this.options.ecmaVersion>=6;this.pos<this.input.length;){var l=this.fullCharCodeAtPos();if(isIdentifierChar(l,o))this.pos+=l<=65535?1:2;else if(l===92){this.containsEsc=!0,t+=this.input.slice(n,this.pos);var d=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var f=this.readCodePoint();(e?isIdentifierStart:isIdentifierChar)(f,o)||this.invalidStringToken(d,"Invalid Unicode escape"),t+=codePointToString(f),n=this.pos}else break;e=!1}return t+this.input.slice(n,this.pos)},pp.readWord=function(){var t=this.readWord1(),e=types$1.name;return this.keywords.test(t)&&(e=keywords[t]),this.finishToken(e,t)};var version="8.12.1";Parser.acorn={Parser,version,defaultOptions:defaultOptions$1,Position,SourceLocation,getLineInfo,Node:Node$3,TokenType,tokTypes:types$1,keywordTypes:keywords,TokContext,tokContexts:types,isIdentifierChar,isIdentifierStart,Token,isNewLine,lineBreak,lineBreakG,nonASCIIwhitespace};var AcornJSX=__toESM(require_acorn_jsx(),1),attributeNames_default={acceptcharset:"acceptCharset",accesskey:"accessKey",allowfullscreen:"allowFullScreen",autocapitalize:"autoCapitalize",autocomplete:"autoComplete",autofocus:"autoFocus",autoplay:"autoPlay",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",class:"className",colspan:"colSpan",contenteditable:"contentEditable",crossorigin:"crossOrigin",datetime:"dateTime",enctype:"encType",for:"htmlFor",formaction:"formAction",formenctype:"formEncType",formmethod:"formMethod",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang",httpequiv:"httpEquiv",inputmode:"inputMode",keyparams:"keyParams",keytype:"keyType",marginheight:"marginHeight",marginwidth:"marginWidth",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",novalidate:"noValidate",radiogroup:"radioGroup",readonly:"readOnly",referrerpolicy:"referrerPolicy",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",usemap:"useMap"},VOID_ELEMENTS=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"],NO_WHITESPACE=["table","tbody","tfoot","thead","tr"];function canHaveChildren(t){return VOID_ELEMENTS.indexOf(t.toLowerCase())===-1}function canHaveWhitespace(t){return NO_WHITESPACE.indexOf(t.toLowerCase())!==-1}class NullishShortCircuit extends Error{constructor(e="Nullish value encountered"){super(e),this.name="NullishShortCircuit"}}var hash=(t="",e=16)=>{const n=String(t);let o=0;return n.split("").forEach(l=>{o=(o<<5)-o+l.charCodeAt(0),o&=o}),Math.abs(o).toString(e)},randomHash=()=>hash(Math.random().toString()),camelCase=t=>t.replace(/([A-Z])([A-Z])/g,"$1 $2").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[^a-zA-Z\u00C0-\u00ff]/g," ").toLowerCase().split(" ").filter(e=>e).map((e,n)=>n>0?e[0].toUpperCase()+e.slice(1):e).join(""),parseStyle=t=>{switch(typeof t){case"string":return t.split(";").filter(e=>e).reduce((e,n)=>{const o=n.slice(0,n.indexOf(":")).trim(),l=n.slice(n.indexOf(":")+1).trim();return{...e,[camelCase(o)]:l}},{});case"object":return t;default:return}},pathToArrayPath=t=>t==null||t===""?[]:t.split("."),resolveArrayPath=(t,e)=>{const[n,...o]=e;if(!(t==null||n==null))return o.length===0?t[n]:resolveArrayPath(t[n],o)},resolvePath=(t,e)=>resolveArrayPath(t,pathToArrayPath(e));function handleNaN(t){return Number.isNaN(t)?"NaN":t}class JsxParser extends React.Component{constructor(){super(...arguments);Xt(this,"ParsedChildren",null);gr(this,tr,n=>{const o=Parser.extend(AcornJSX.default({autoCloseVoidElements:this.props.autoCloseVoidElements})),l=`<root>${n}</root>`;let d=[];try{d=o.parse(l,{ecmaVersion:"latest"}),d=d.body[0].expression.children||[]}catch(f){return this.props.showWarnings&&console.warn(f),this.props.onError&&this.props.onError(f),this.props.renderError?this.props.renderError({error:String(f)}):null}return d.map(f=>Jt(this,Yt).call(this,f)).filter(Boolean)});gr(this,Yt,(n,o)=>{var l,d;switch(n.type){case"JSXAttribute":return n.value===null?!0:Jt(this,Yt).call(this,n.value,o);case"JSXElement":case"JSXFragment":return Jt(this,Pr).call(this,n,o);case"JSXExpressionContainer":return Jt(this,Yt).call(this,n.expression,o);case"JSXText":const f=this.props.disableKeyGeneration?void 0:randomHash();return this.props.disableFragments?n.value:React.createElement(React.Fragment,{key:f},n.value);case"ArrayExpression":return n.elements.map(A=>Jt(this,Yt).call(this,A,o));case"BinaryExpression":const g=Jt(this,Yt).call(this,n.left,o),b=Jt(this,Yt).call(this,n.right,o);let _;switch(n.operator){case"-":_=g-b;break;case"!=":_=g!=b;break;case"!==":_=g!==b;break;case"*":_=g*b;break;case"**":_=g**b;break;case"/":_=g/b;break;case"%":_=g%b;break;case"+":_=g+b;break;case"<":_=g<b;break;case"<=":_=g<=b;break;case"==":_=g==b;break;case"===":_=g===b;break;case">":_=g>b;break;case">=":_=g>=b;break;default:this.props.onError(new Error(`Unsupported binary operator: ${n.operator}`));return}return handleNaN(_);case"CallExpression":const S=Jt(this,Yt).call(this,n.callee,o);if(S===void 0){if(n.optional)throw new NullishShortCircuit;this.props.onError(new Error(`The expression '${n.callee}' could not be resolved, resulting in an undefined return value.`));return}return S(...n.arguments.map(A=>Jt(this,Yt).call(this,A,o)));case"ConditionalExpression":return Jt(this,Yt).call(this,n.test,o)?Jt(this,Yt).call(this,n.consequent,o):Jt(this,Yt).call(this,n.alternate,o);case"ExpressionStatement":return Jt(this,Yt).call(this,n.expression,o);case"Identifier":return n.name==="Infinity"?1/0:n.name==="-Infinity"?-1/0:n.name==="NaN"?NaN:o&&n.name in o?handleNaN(o[n.name]):handleNaN((this.props.bindings||{})[n.name]);case"Literal":return n.value;case"LogicalExpression":const R=Jt(this,Yt).call(this,n.left,o);return n.operator==="||"&&R?R:n.operator==="&&"&&R||n.operator==="||"&&!R?Jt(this,Yt).call(this,n.right,o):!1;case"MemberExpression":return Jt(this,Ar).call(this,n,o);case"ChainExpression":return Jt(this,Er).call(this,n,o);case"ObjectExpression":const C={};return n.properties.forEach(A=>{C[A.key.name||A.key.value]=Jt(this,Yt).call(this,A.value,o)}),C;case"TemplateElement":return n.value.cooked;case"TemplateLiteral":return[...n.expressions,...n.quasis].sort((A,I)=>A.start<I.start?-1:1).map(A=>Jt(this,Yt).call(this,A,o)).join("");case"UnaryExpression":const E=Jt(this,Yt).call(this,n.argument,o);switch(n.operator){case"+":return+E;case"-":return-E;case"!":return!E}return;case"ArrowFunctionExpression":return(n.async||n.generator)&&((d=(l=this.props).onError)==null||d.call(l,new Error("Async and generator arrow functions are not supported."))),(...A)=>{const I={...o};return n.params.forEach((M,j)=>{I[M.name]=A[j]}),Jt(this,Yt).call(this,n.body,I)};default:this.props.onError(new Error(`The expression type '${n.type}' is not supported.`));return}});gr(this,Er,(n,o)=>{try{return Jt(this,Yt).call(this,n.expression,o)}catch(l){if(l instanceof NullishShortCircuit)return;throw l}});gr(this,Ar,(n,o)=>{const l=Jt(this,Yt).call(this,n.object,o);let d;if(n.computed)d=Jt(this,Yt).call(this,n.property,o);else if(n.property.type==="Identifier")d=n.property.name;else{this.props.onError(new Error("Only simple MemberExpressions are supported."));return}if(l==null&&n.optional)throw new NullishShortCircuit;let f;try{f=l[d]}catch{this.props.onError(new Error(`The property '${d}' could not be resolved on the object '${l}'.`));return}return typeof f=="function"?f.bind(l):f});gr(this,yr,n=>n.type==="JSXIdentifier"?n.name:`${Jt(this,yr).call(this,n.object)}.${Jt(this,yr).call(this,n.property)}`);gr(this,Pr,(n,o)=>{const{allowUnknownElements:l,components:d,componentsOnly:f,onError:g}=this.props,{children:b=[]}=n,_=n.type==="JSXElement"?n.openingElement:n.openingFragment,{attributes:S=[]}=_,R=n.type==="JSXElement"?Jt(this,yr).call(this,_.name):"",C=(this.props.blacklistedAttrs||[]).map(z=>z instanceof RegExp?z:new RegExp(z,"i")),E=(this.props.blacklistedTags||[]).map(z=>z.trim().toLowerCase()).filter(Boolean);if(/^(html|head|body)$/i.test(R))return b.map(z=>Jt(this,Pr).call(this,z,o));const A=R.trim().toLowerCase();if(E.indexOf(A)!==-1)return g(new Error(`The tag <${R}> is blacklisted, and will not be rendered.`)),null;if(R!==""&&!resolvePath(d,R)){if(f)return g(new Error(`The component <${R}> is unrecognized, and will not be rendered.`)),this.props.renderUnrecognized(R);if(!l&&document.createElement(R)instanceof HTMLUnknownElement)return g(new Error(`The tag <${R}> is unrecognized in this browser, and will not be rendered.`)),this.props.renderUnrecognized(R)}let I,M=n.type==="JSXElement"?resolvePath(d,R):React.Fragment;if(M||canHaveChildren(R)){if(I=b.map(Q=>Jt(this,Yt).call(this,Q,o)),R.includes(".")){const F=R.split(".").reduce((O,te)=>O?O[te]:d==null?void 0:d[te],null);F&&(M=F)}!M&&!canHaveWhitespace(R)&&(I=I.filter(Q=>typeof Q!="string"||!/^\s*$/.test(Q)));const z=I.find(Q=>typeof Q=="function");I.length===0?I=void 0:z?I=z:I.length===1?[I]=I:I.length>1&&!this.props.disableKeyGeneration&&(I=I.map((Q,F)=>Q!=null&&Q.type&&!(Q!=null&&Q.key)?{...Q,key:Q.key||F}:Q))}const j={key:this.props.disableKeyGeneration?void 0:randomHash()};S.forEach(z=>{if(z.type==="JSXAttribute"){const Q=z.name.name,F=attributeNames_default[Q]||Q,O=Jt(this,Yt).call(this,z,o);C.filter(ne=>ne.test(F)).length===0&&(j[F]=O)}else if(z.type==="JSXSpreadAttribute"&&z.argument.type==="Identifier"||z.argument.type==="MemberExpression"){const Q=Jt(this,Yt).call(this,z.argument,o);typeof Q=="object"&&Object.keys(Q).forEach(F=>{const O=attributeNames_default[F]||F;C.filter(ne=>ne.test(O)).length===0&&(j[O]=Q[F])})}}),typeof j.style=="string"&&(j.style=parseStyle(j.style));const q=R.toLowerCase();return q==="option"&&(I=I.props.children),React.createElement(M||q,j,I)})}render(){const n=(this.props.jsx||"").trim().replace(/<!DOCTYPE([^>]*)>/g,"");this.ParsedChildren=Jt(this,tr).call(this,n);const o=[...new Set(["jsx-parser",...String(this.props.className).split(" ")])].filter(Boolean).join(" ");return this.props.renderInWrapper?React.createElement("div",{className:o},this.ParsedChildren):this.ParsedChildren}}tr=new WeakMap,Yt=new WeakMap,Er=new WeakMap,Ar=new WeakMap,yr=new WeakMap,Pr=new WeakMap,Xt(JsxParser,"displayName","JsxParser"),Xt(JsxParser,"defaultProps",{allowUnknownElements:!0,autoCloseVoidElements:!1,bindings:{},blacklistedAttrs:[/^on.+/i],blacklistedTags:["script"],className:"",components:{},componentsOnly:!1,disableFragments:!1,disableKeyGeneration:!1,jsx:"",onError:()=>{},showWarnings:!1,renderError:void 0,renderInWrapper:!0,renderUnrecognized:()=>null});var source_default=JsxParser;const CountryFlag=({countryCode:t,className:e=""})=>{const[n,o]=React.useState(null),[l,d]=React.useState(!1);return React.useEffect(()=>{if(!t)return;const g=`https://purecatamphetamine.github.io/country-flag-icons/3x2/${t.toUpperCase()}.svg`;fetch(g,{method:"HEAD"}).then(b=>{b.ok?(o(g),d(!1)):d(!0)}).catch(()=>{d(!0)})},[t]),l||!n?jsxRuntime.jsx("span",{className:e,children:t}):jsxRuntime.jsx("img",{src:n,alt:`${t} flag`,className:`inline-block ${e}`,style:{width:"24px",height:"auto"}})};function ProductCard({applicationId:t,product:e,viewProductLink:n,defaultOpportunityNumber:o="",onAddToCart:l,addingToCart:d=!1,shopifyHostname:f,customAction:g=jsxRuntime.jsx(jsxRuntime.Fragment,{})}){var it,st,Ue,Rt,Je,mt,$t,Dt,Ht,Vt,We,nt;const b=React.useRef(null),_=useIntersectionObserver({elementRef:b,threshold:.1,rootMargin:"100px",freezeOnceVisible:!0}),{toast:S}=useToast(),[R,C]=React.useState(1),[E,A]=React.useState(null),[I,M]=React.useState(0),[j,q]=React.useState(!1),[z,Q]=React.useState(!1),[F,O]=React.useState(!1),[te]=usePutV4ResellerByRouteResellerIdProductAndRandmarSkuRequisitionMutation(),[ne,ae]=React.useState(!1),[ge]=usePostV4ResellerByRouteResellerIdProductAndRandmarSkuShopifyMutation(),{data:oe,isLoading:je,isFetching:Ne}=useGetV4PartnerByApplicationIdAccountQuery({applicationId:t},{skip:!t||!_}),Ae=((it=e==null?void 0:e.Distribution)==null?void 0:it.Cost)||0,$e=((st=e==null?void 0:e.Distribution)==null?void 0:st.RegularPrice)||0,Fe=((Ue=e==null?void 0:e.Distribution)==null?void 0:Ue.Price)||0,ze=React.useMemo(()=>{var Qe;return!((Qe=e==null?void 0:e.Distribution)!=null&&Qe.Inventory)||e.Distribution.Inventory.length===0?0:e.Distribution.Inventory.reduce((dt,pt)=>dt+(pt.PurchaseOrderQuantity||0),0)},[(Rt=e==null?void 0:e.Distribution)==null?void 0:Rt.Inventory]);React.useEffect(()=>{C(1),A(null),M(0),q(!1)},[e==null?void 0:e.RandmarSKU]),React.useEffect(()=>{var Qe;if(e&&o){const dt=(Qe=e.Opportunities)==null?void 0:Qe.find(pt=>pt.BidNumber==o);dt&&A(dt)}},[e,o]),React.useEffect(()=>{if(!e)return;const Qe=E!=null&&E.Price?E.Price:Fe;M($e>0?Math.round(($e-Qe)/$e*100):0)},[e,E,Fe,$e]),React.useEffect(()=>{d||C(1)},[d]);const Ve=Qe=>{if(Qe.Active!==!0)return!1;const dt=new Date().toISOString().split("T")[0];return!(Qe.EndDate&&Qe.EndDate.split("T")[0]<dt||Qe.StartDate&&Qe.StartDate.split("T")[0]>dt)};if(React.useEffect(()=>{d||C(1)},[d]),!e||je||Ne)return jsxRuntime.jsx(Card,{children:jsxRuntime.jsxs(CardContent,{className:"p-6",children:[jsxRuntime.jsxs("div",{className:"flex justify-between products-start mb-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx("div",{className:"h-10 w-24 flex products-center justify-end ml-4",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"})})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-24 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-28 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex gap-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-6 flex-1",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col",children:jsxRuntime.jsx("div",{className:"w-60 h-40",children:jsxRuntime.jsx(Skeleton,{className:"w-full h-full rounded-lg"})})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsx("div",{className:"flex flex-1",children:jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24 mb-3"}),jsxRuntime.jsx(Skeleton,{className:"h-16 w-full rounded-md"})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col products-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-32 rounded-md"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24 mt-4"})]})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-col products-start gap-1 mb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex flex-1 products-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"}),jsxRuntime.jsx(Skeleton,{className:"h-10 flex-1 rounded-md"})]})]})]})});const Be=(e==null?void 0:e.Opportunities)||[],qe=Be.length>0,Ke=()=>{if(R==null){C(1);return}R>1&&C(R-1)},He=()=>{if(R==null){C(1);return}C(R+1)},Xe=Qe=>{const dt=Number.parseInt(Qe.target.value,10);if(!isNaN(dt)&&dt>0){C(dt);return}C(void 0)},tt=()=>{(R==null||R<1)&&C(1)},Ye=()=>{z||!(oe!=null&&oe.IsReseller)||(Q(!0),te({routeResellerId:oe.ApplicationId??"",randmarSku:e.RandmarSKU??""}).then(Qe=>{if(Qe.error){console.error(Qe.error),S({title:"Error",description:"Error submitting your qualification.",variant:"destructive"});return}S({title:"Success",description:"Qualification successfully submitted.",variant:"success"}),O(!1)}).catch(Qe=>{console.error(Qe),S({title:"Error",description:"Error submitting your qualification.",variant:"destructive"})}).finally(()=>{Q(!1)}))},et=((mt=(Je=e.Distribution)==null?void 0:Je.Inventory)==null?void 0:mt.reduce((Qe,dt)=>Qe+(dt.AvailableQuantity||0),0))||0,Ze=Qe=>{try{return new Date(Qe).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch(dt){return console.error(dt),Qe.split("T")[0]||"N/A"}},at=()=>{typeof l<"u"&&l({quantity:R??1,bidNumber:(E==null?void 0:E.BidNumber)??null})},rt=()=>{ne||!f||(ae(!0),ge({routeResellerId:t??"",randmarSku:e.RandmarSKU??"",shopifyHostName:f}).then(Qe=>{if(Qe.error){console.error("Error syncing to Shopify:",Qe.error),S({title:"Product synced failed.",description:"Error syncing to Shopify:",variant:"destructive"});return}S({title:"Product synced",description:"Product synced to Shopify successfully",variant:"success"})}).catch(Qe=>{console.error("Error syncing to Shopify:",Qe),S({title:"Product synced failed.",description:"Error syncing to Shopify:",variant:"destructive"})}).finally(()=>{ae(!1)}))};return jsxRuntime.jsx(Card,{className:"hover:shadow-lg transition-shadow",ref:b,children:jsxRuntime.jsxs(CardContent,{className:"p-6",children:[jsxRuntime.jsxs("div",{className:"flex justify-between products-start mb-3",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-xl",children:e.Title||e.RandmarTitle}),jsxRuntime.jsx("div",{className:"w-24 h-10 flex products-center justify-end ml-4",children:jsxRuntime.jsx(PartnerLogo,{id:e.ManufacturerId,name:e.ManufacturerName,width:96,height:40})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[e.State&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.State==="Active"?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(Check,{size:"12",className:"mr-1.5"})," ",e.State]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.SerialNumber?"bg-green-50 text-green-700 hover:bg-green-50":"bg-yellow-50 text-yellow-700 hover:bg-yellow-50"}`,children:[jsxRuntime.jsx(QrCode,{size:"12",className:"mr-1.5"})," ",e.SerialNumber?"Serialized":"Unserialized"]}),e.TransparencyCode&&jsxRuntime.jsxs(Badge,{variant:"outline",className:"rounded-full px-3 bg-green-50 text-green-700 hover:bg-green-50",children:[jsxRuntime.jsx(CircleDashed,{size:"12",className:"mr-1.5"})," Transparency Code"]}),e.AvailableToBuy!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.AvailableToBuy?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(ShoppingCart,{size:"12",className:"mr-1.5"})," ",e.AvailableToBuy?"Available":"Unavailable"]}),e.ManufacturerCategory!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${($t=e.ManufacturerCategory)!=null&&$t.QualificationRequired?"bg-blue-50 text-blue-700 hover:bg-blue-50":"bg-neutral-50 text-neutral-700 hover:bg-neutral-50"}`,children:[jsxRuntime.jsx(ShieldCheck,{size:"12",className:"mr-1.5"})," ",(Dt=e.ManufacturerCategory)!=null&&Dt.QualificationRequired?"Qualified Only":"Available to all"]}),e.ManufacturerId&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.AutoUpdate?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(RefreshCw,{size:"12",className:"mr-1.5"})," ",e.AutoUpdate?`Automatic Reorder (${e.MasterCarton})`:"Manually Reorders"]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.BodyHTML&&e.Title&&e.MAP?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(Store,{size:"12",className:"mr-1.5"})," ",e.BodyHTML&&e.Title&&e.MAP?"Shopify Ready":"Not Shopify Ready"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4 flex-1",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"MPN"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.MPN||"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"UPC"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.UPC||"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Unit Weight"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.UnitWeight?`${e.UnitWeight} lbs`:"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"MAP"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.MAP?"$"+e.MAP.toFixed(2):"N/A"})]}),e.OverallPercentileRank&&e.ManufacturerPercentileRank&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Percentile"}),jsxRuntime.jsxs("div",{className:`font-medium flex products-center ${e.OverallPercentileRank>=80?"text-green-700":""}`,children:[Math.round(e.OverallPercentileRank)," Overall"]}),jsxRuntime.jsxs("div",{className:"font-light flex products-center text-sm",children:[Math.round(e.ManufacturerPercentileRank)," with Manufacturer"]})]}),e.CountryCodeOfOrigin&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Origin"}),jsxRuntime.jsxs("div",{className:"font-medium flex products-center",children:[jsxRuntime.jsx(CountryFlag,{countryCode:e.CountryCodeOfOrigin,className:"mr-2"}),e.CountryCodeOfOrigin]})]})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col",children:jsxRuntime.jsx(ProductImage,{randmarSKU:e.RandmarSKU||"",alt:e.RandmarTitle||""})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsx("div",{className:"flex flex-1",children:qe&&e.Distribution&&jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx("div",{className:"flex products-center",children:"You have "+Be.length+(Be.length>1?" opportunities":" opportunity")+" for this product:"}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-[200px] overflow-y-auto p-2 mt-1",children:Be.map((Qe,dt)=>{var pt;return jsxRuntime.jsxs("div",{className:`flex justify-between products-center rounded-lg transition-colors py-2 px-4 bg-purple-100 border border-muted
1066
+ `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return codePointToString(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),t){var n=this.pos-1;this.invalidStringToken(n,"Invalid escape sequence in template string")}default:if(e>=48&&e<=55){var o=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],l=parseInt(o,8);return l>255&&(o=o.slice(0,-1),l=parseInt(o,8)),this.pos+=o.length-1,e=this.input.charCodeAt(this.pos),(o!=="0"||e===56||e===57)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-o.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(l)}return isNewLine(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}},pp.readHexChar=function(t){var e=this.pos,n=this.readInt(16,t);return n===null&&this.invalidStringToken(e,"Bad character escape sequence"),n},pp.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,n=this.pos,o=this.options.ecmaVersion>=6;this.pos<this.input.length;){var l=this.fullCharCodeAtPos();if(isIdentifierChar(l,o))this.pos+=l<=65535?1:2;else if(l===92){this.containsEsc=!0,t+=this.input.slice(n,this.pos);var d=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var f=this.readCodePoint();(e?isIdentifierStart:isIdentifierChar)(f,o)||this.invalidStringToken(d,"Invalid Unicode escape"),t+=codePointToString(f),n=this.pos}else break;e=!1}return t+this.input.slice(n,this.pos)},pp.readWord=function(){var t=this.readWord1(),e=types$1.name;return this.keywords.test(t)&&(e=keywords[t]),this.finishToken(e,t)};var version="8.12.1";Parser.acorn={Parser,version,defaultOptions:defaultOptions$1,Position,SourceLocation,getLineInfo,Node:Node$3,TokenType,tokTypes:types$1,keywordTypes:keywords,TokContext,tokContexts:types,isIdentifierChar,isIdentifierStart,Token,isNewLine,lineBreak,lineBreakG,nonASCIIwhitespace};var AcornJSX=__toESM(require_acorn_jsx(),1),attributeNames_default={acceptcharset:"acceptCharset",accesskey:"accessKey",allowfullscreen:"allowFullScreen",autocapitalize:"autoCapitalize",autocomplete:"autoComplete",autofocus:"autoFocus",autoplay:"autoPlay",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",class:"className",colspan:"colSpan",contenteditable:"contentEditable",crossorigin:"crossOrigin",datetime:"dateTime",enctype:"encType",for:"htmlFor",formaction:"formAction",formenctype:"formEncType",formmethod:"formMethod",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang",httpequiv:"httpEquiv",inputmode:"inputMode",keyparams:"keyParams",keytype:"keyType",marginheight:"marginHeight",marginwidth:"marginWidth",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",novalidate:"noValidate",radiogroup:"radioGroup",readonly:"readOnly",referrerpolicy:"referrerPolicy",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",usemap:"useMap"},VOID_ELEMENTS=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"],NO_WHITESPACE=["table","tbody","tfoot","thead","tr"];function canHaveChildren(t){return VOID_ELEMENTS.indexOf(t.toLowerCase())===-1}function canHaveWhitespace(t){return NO_WHITESPACE.indexOf(t.toLowerCase())!==-1}class NullishShortCircuit extends Error{constructor(e="Nullish value encountered"){super(e),this.name="NullishShortCircuit"}}var hash=(t="",e=16)=>{const n=String(t);let o=0;return n.split("").forEach(l=>{o=(o<<5)-o+l.charCodeAt(0),o&=o}),Math.abs(o).toString(e)},randomHash=()=>hash(Math.random().toString()),camelCase=t=>t.replace(/([A-Z])([A-Z])/g,"$1 $2").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[^a-zA-Z\u00C0-\u00ff]/g," ").toLowerCase().split(" ").filter(e=>e).map((e,n)=>n>0?e[0].toUpperCase()+e.slice(1):e).join(""),parseStyle=t=>{switch(typeof t){case"string":return t.split(";").filter(e=>e).reduce((e,n)=>{const o=n.slice(0,n.indexOf(":")).trim(),l=n.slice(n.indexOf(":")+1).trim();return{...e,[camelCase(o)]:l}},{});case"object":return t;default:return}},pathToArrayPath=t=>t==null||t===""?[]:t.split("."),resolveArrayPath=(t,e)=>{const[n,...o]=e;if(!(t==null||n==null))return o.length===0?t[n]:resolveArrayPath(t[n],o)},resolvePath=(t,e)=>resolveArrayPath(t,pathToArrayPath(e));function handleNaN(t){return Number.isNaN(t)?"NaN":t}class JsxParser extends React.Component{constructor(){super(...arguments);Xt(this,"ParsedChildren",null);gr(this,tr,n=>{const o=Parser.extend(AcornJSX.default({autoCloseVoidElements:this.props.autoCloseVoidElements})),l=`<root>${n}</root>`;let d=[];try{d=o.parse(l,{ecmaVersion:"latest"}),d=d.body[0].expression.children||[]}catch(f){return this.props.showWarnings&&console.warn(f),this.props.onError&&this.props.onError(f),this.props.renderError?this.props.renderError({error:String(f)}):null}return d.map(f=>Jt(this,Yt).call(this,f)).filter(Boolean)});gr(this,Yt,(n,o)=>{var l,d;switch(n.type){case"JSXAttribute":return n.value===null?!0:Jt(this,Yt).call(this,n.value,o);case"JSXElement":case"JSXFragment":return Jt(this,Pr).call(this,n,o);case"JSXExpressionContainer":return Jt(this,Yt).call(this,n.expression,o);case"JSXText":const f=this.props.disableKeyGeneration?void 0:randomHash();return this.props.disableFragments?n.value:React.createElement(React.Fragment,{key:f},n.value);case"ArrayExpression":return n.elements.map(A=>Jt(this,Yt).call(this,A,o));case"BinaryExpression":const g=Jt(this,Yt).call(this,n.left,o),b=Jt(this,Yt).call(this,n.right,o);let _;switch(n.operator){case"-":_=g-b;break;case"!=":_=g!=b;break;case"!==":_=g!==b;break;case"*":_=g*b;break;case"**":_=g**b;break;case"/":_=g/b;break;case"%":_=g%b;break;case"+":_=g+b;break;case"<":_=g<b;break;case"<=":_=g<=b;break;case"==":_=g==b;break;case"===":_=g===b;break;case">":_=g>b;break;case">=":_=g>=b;break;default:this.props.onError(new Error(`Unsupported binary operator: ${n.operator}`));return}return handleNaN(_);case"CallExpression":const S=Jt(this,Yt).call(this,n.callee,o);if(S===void 0){if(n.optional)throw new NullishShortCircuit;this.props.onError(new Error(`The expression '${n.callee}' could not be resolved, resulting in an undefined return value.`));return}return S(...n.arguments.map(A=>Jt(this,Yt).call(this,A,o)));case"ConditionalExpression":return Jt(this,Yt).call(this,n.test,o)?Jt(this,Yt).call(this,n.consequent,o):Jt(this,Yt).call(this,n.alternate,o);case"ExpressionStatement":return Jt(this,Yt).call(this,n.expression,o);case"Identifier":return n.name==="Infinity"?1/0:n.name==="-Infinity"?-1/0:n.name==="NaN"?NaN:o&&n.name in o?handleNaN(o[n.name]):handleNaN((this.props.bindings||{})[n.name]);case"Literal":return n.value;case"LogicalExpression":const R=Jt(this,Yt).call(this,n.left,o);return n.operator==="||"&&R?R:n.operator==="&&"&&R||n.operator==="||"&&!R?Jt(this,Yt).call(this,n.right,o):!1;case"MemberExpression":return Jt(this,Ar).call(this,n,o);case"ChainExpression":return Jt(this,Er).call(this,n,o);case"ObjectExpression":const C={};return n.properties.forEach(A=>{C[A.key.name||A.key.value]=Jt(this,Yt).call(this,A.value,o)}),C;case"TemplateElement":return n.value.cooked;case"TemplateLiteral":return[...n.expressions,...n.quasis].sort((A,I)=>A.start<I.start?-1:1).map(A=>Jt(this,Yt).call(this,A,o)).join("");case"UnaryExpression":const E=Jt(this,Yt).call(this,n.argument,o);switch(n.operator){case"+":return+E;case"-":return-E;case"!":return!E}return;case"ArrowFunctionExpression":return(n.async||n.generator)&&((d=(l=this.props).onError)==null||d.call(l,new Error("Async and generator arrow functions are not supported."))),(...A)=>{const I={...o};return n.params.forEach((M,j)=>{I[M.name]=A[j]}),Jt(this,Yt).call(this,n.body,I)};default:this.props.onError(new Error(`The expression type '${n.type}' is not supported.`));return}});gr(this,Er,(n,o)=>{try{return Jt(this,Yt).call(this,n.expression,o)}catch(l){if(l instanceof NullishShortCircuit)return;throw l}});gr(this,Ar,(n,o)=>{const l=Jt(this,Yt).call(this,n.object,o);let d;if(n.computed)d=Jt(this,Yt).call(this,n.property,o);else if(n.property.type==="Identifier")d=n.property.name;else{this.props.onError(new Error("Only simple MemberExpressions are supported."));return}if(l==null&&n.optional)throw new NullishShortCircuit;let f;try{f=l[d]}catch{this.props.onError(new Error(`The property '${d}' could not be resolved on the object '${l}'.`));return}return typeof f=="function"?f.bind(l):f});gr(this,yr,n=>n.type==="JSXIdentifier"?n.name:`${Jt(this,yr).call(this,n.object)}.${Jt(this,yr).call(this,n.property)}`);gr(this,Pr,(n,o)=>{const{allowUnknownElements:l,components:d,componentsOnly:f,onError:g}=this.props,{children:b=[]}=n,_=n.type==="JSXElement"?n.openingElement:n.openingFragment,{attributes:S=[]}=_,R=n.type==="JSXElement"?Jt(this,yr).call(this,_.name):"",C=(this.props.blacklistedAttrs||[]).map(z=>z instanceof RegExp?z:new RegExp(z,"i")),E=(this.props.blacklistedTags||[]).map(z=>z.trim().toLowerCase()).filter(Boolean);if(/^(html|head|body)$/i.test(R))return b.map(z=>Jt(this,Pr).call(this,z,o));const A=R.trim().toLowerCase();if(E.indexOf(A)!==-1)return g(new Error(`The tag <${R}> is blacklisted, and will not be rendered.`)),null;if(R!==""&&!resolvePath(d,R)){if(f)return g(new Error(`The component <${R}> is unrecognized, and will not be rendered.`)),this.props.renderUnrecognized(R);if(!l&&document.createElement(R)instanceof HTMLUnknownElement)return g(new Error(`The tag <${R}> is unrecognized in this browser, and will not be rendered.`)),this.props.renderUnrecognized(R)}let I,M=n.type==="JSXElement"?resolvePath(d,R):React.Fragment;if(M||canHaveChildren(R)){if(I=b.map(Q=>Jt(this,Yt).call(this,Q,o)),R.includes(".")){const F=R.split(".").reduce((O,te)=>O?O[te]:d==null?void 0:d[te],null);F&&(M=F)}!M&&!canHaveWhitespace(R)&&(I=I.filter(Q=>typeof Q!="string"||!/^\s*$/.test(Q)));const z=I.find(Q=>typeof Q=="function");I.length===0?I=void 0:z?I=z:I.length===1?[I]=I:I.length>1&&!this.props.disableKeyGeneration&&(I=I.map((Q,F)=>Q!=null&&Q.type&&!(Q!=null&&Q.key)?{...Q,key:Q.key||F}:Q))}const j={key:this.props.disableKeyGeneration?void 0:randomHash()};S.forEach(z=>{if(z.type==="JSXAttribute"){const Q=z.name.name,F=attributeNames_default[Q]||Q,O=Jt(this,Yt).call(this,z,o);C.filter(ne=>ne.test(F)).length===0&&(j[F]=O)}else if(z.type==="JSXSpreadAttribute"&&z.argument.type==="Identifier"||z.argument.type==="MemberExpression"){const Q=Jt(this,Yt).call(this,z.argument,o);typeof Q=="object"&&Object.keys(Q).forEach(F=>{const O=attributeNames_default[F]||F;C.filter(ne=>ne.test(O)).length===0&&(j[O]=Q[F])})}}),typeof j.style=="string"&&(j.style=parseStyle(j.style));const q=R.toLowerCase();return q==="option"&&(I=I.props.children),React.createElement(M||q,j,I)})}render(){const n=(this.props.jsx||"").trim().replace(/<!DOCTYPE([^>]*)>/g,"");this.ParsedChildren=Jt(this,tr).call(this,n);const o=[...new Set(["jsx-parser",...String(this.props.className).split(" ")])].filter(Boolean).join(" ");return this.props.renderInWrapper?React.createElement("div",{className:o},this.ParsedChildren):this.ParsedChildren}}tr=new WeakMap,Yt=new WeakMap,Er=new WeakMap,Ar=new WeakMap,yr=new WeakMap,Pr=new WeakMap,Xt(JsxParser,"displayName","JsxParser"),Xt(JsxParser,"defaultProps",{allowUnknownElements:!0,autoCloseVoidElements:!1,bindings:{},blacklistedAttrs:[/^on.+/i],blacklistedTags:["script"],className:"",components:{},componentsOnly:!1,disableFragments:!1,disableKeyGeneration:!1,jsx:"",onError:()=>{},showWarnings:!1,renderError:void 0,renderInWrapper:!0,renderUnrecognized:()=>null});var source_default=JsxParser;const CountryFlag=({countryCode:t,className:e=""})=>{const[n,o]=React.useState(null),[l,d]=React.useState(!1);return React.useEffect(()=>{if(!t)return;const g=`https://purecatamphetamine.github.io/country-flag-icons/3x2/${t.toUpperCase()}.svg`;fetch(g,{method:"HEAD"}).then(b=>{b.ok?(o(g),d(!1)):d(!0)}).catch(()=>{d(!0)})},[t]),l||!n?jsxRuntime.jsx("span",{className:e,children:t}):jsxRuntime.jsx("img",{src:n,alt:`${t} flag`,className:`inline-block ${e}`,style:{width:"24px",height:"auto"}})};function ProductCard({applicationId:t,product:e,viewProductLink:n,defaultOpportunityNumber:o="",onAddToCart:l,addingToCart:d=!1,shopifyHostname:f,customAction:g=jsxRuntime.jsx(jsxRuntime.Fragment,{})}){var it,st,Ue,Rt,Je,mt,$t,Dt,Ht,Vt,We,nt;const b=React.useRef(null),_=useIntersectionObserver({elementRef:b,threshold:.1,rootMargin:"100px",freezeOnceVisible:!0}),{toast:S}=useToast(),[R,C]=React.useState(1),[E,A]=React.useState(null),[I,M]=React.useState(0),[j,q]=React.useState(!1),[z,Q]=React.useState(!1),[F,O]=React.useState(!1),[te]=usePutV4ResellerByRouteResellerIdProductAndRandmarSkuRequisitionMutation(),[ne,ae]=React.useState(!1),[ge]=usePostV4ResellerByRouteResellerIdProductAndRandmarSkuShopifyMutation(),{data:oe,isLoading:je,isFetching:Ne}=useGetV4PartnerByApplicationIdAccountQuery({applicationId:t},{skip:!t||!_}),Ae=((it=e==null?void 0:e.Distribution)==null?void 0:it.Cost)||0,$e=((st=e==null?void 0:e.Distribution)==null?void 0:st.RegularPrice)||0,Fe=((Ue=e==null?void 0:e.Distribution)==null?void 0:Ue.Price)||0,ze=React.useMemo(()=>{var Qe;return!((Qe=e==null?void 0:e.Distribution)!=null&&Qe.Inventory)||e.Distribution.Inventory.length===0?0:e.Distribution.Inventory.reduce((dt,pt)=>dt+(pt.PurchaseOrderQuantity||0),0)},[(Rt=e==null?void 0:e.Distribution)==null?void 0:Rt.Inventory]);React.useEffect(()=>{C(1),A(null),M(0),q(!1)},[e==null?void 0:e.RandmarSKU]),React.useEffect(()=>{var Qe;if(e&&o){const dt=(Qe=e.Opportunities)==null?void 0:Qe.find(pt=>pt.BidNumber==o);dt&&A(dt)}},[e,o]),React.useEffect(()=>{if(!e)return;const Qe=E!=null&&E.Price?E.Price:Fe;M($e>0?Math.round(($e-Qe)/$e*100):0)},[e,E,Fe,$e]),React.useEffect(()=>{d||C(1)},[d]);const Ve=Qe=>{if(Qe.Active!==!0)return!1;const dt=new Date().toISOString().split("T")[0];return!(Qe.EndDate&&Qe.EndDate.split("T")[0]<dt||Qe.StartDate&&Qe.StartDate.split("T")[0]>dt)};if(React.useEffect(()=>{d||C(1)},[d]),!e||je||Ne)return jsxRuntime.jsx(Card,{children:jsxRuntime.jsxs(CardContent,{className:"p-6",children:[jsxRuntime.jsxs("div",{className:"flex justify-between products-start mb-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx("div",{className:"h-10 w-24 flex products-center justify-end ml-4",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"})})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-24 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-28 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex gap-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-6 flex-1",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col",children:jsxRuntime.jsx("div",{className:"w-60 h-40",children:jsxRuntime.jsx(Skeleton,{className:"w-full h-full rounded-lg"})})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsx("div",{className:"flex flex-1",children:jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24 mb-3"}),jsxRuntime.jsx(Skeleton,{className:"h-16 w-full rounded-md"})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col products-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-32 rounded-md"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24 mt-4"})]})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-col products-start gap-1 mb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex flex-1 products-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"}),jsxRuntime.jsx(Skeleton,{className:"h-10 flex-1 rounded-md"})]})]})]})});const Be=(e==null?void 0:e.Opportunities)||[],qe=Be.length>0,Ke=()=>{if(R==null){C(1);return}R>1&&C(R-1)},He=()=>{if(R==null){C(1);return}C(R+1)},Xe=Qe=>{const dt=Number.parseInt(Qe.target.value,10);if(!isNaN(dt)&&dt>0){C(dt);return}C(void 0)},tt=()=>{(R==null||R<1)&&C(1)},Ye=()=>{z||!(oe!=null&&oe.IsReseller)||(Q(!0),te({routeResellerId:oe.ApplicationId??"",randmarSku:e.RandmarSKU??""}).then(Qe=>{if(Qe.error){console.error(Qe.error),S({title:"Error",description:"Error submitting your qualification.",variant:"destructive"});return}S({title:"Success",description:"Qualification successfully submitted.",variant:"success"}),O(!1)}).catch(Qe=>{console.error(Qe),S({title:"Error",description:"Error submitting your qualification.",variant:"destructive"})}).finally(()=>{Q(!1)}))},et=((mt=(Je=e.Distribution)==null?void 0:Je.Inventory)==null?void 0:mt.reduce((Qe,dt)=>Qe+(dt.AvailableQuantity||0),0))||0,Ze=Qe=>{try{return new Date(Qe).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch(dt){return console.error(dt),Qe.split("T")[0]||"N/A"}},at=()=>{typeof l<"u"&&l({quantity:R??1,bidNumber:(E==null?void 0:E.BidNumber)??null})},rt=()=>{ne||!f||(ae(!0),ge({routeResellerId:t??"",randmarSku:e.RandmarSKU??"",shopifyHostName:f}).then(Qe=>{if(Qe.error){console.error("Error syncing to Shopify:",Qe.error),S({title:"Product synced failed.",description:"Error syncing to Shopify:",variant:"destructive"});return}S({title:"Product synced",description:"Product synced to Shopify successfully",variant:"success"})}).catch(Qe=>{console.error("Error syncing to Shopify:",Qe),S({title:"Product synced failed.",description:"Error syncing to Shopify:",variant:"destructive"})}).finally(()=>{ae(!1)}))};return jsxRuntime.jsx(Card,{className:"hover:shadow-lg transition-shadow",ref:b,children:jsxRuntime.jsxs(CardContent,{className:"p-6",children:[jsxRuntime.jsxs("div",{className:"flex justify-between products-start mb-3",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-xl",children:e.Title||e.RandmarTitle}),jsxRuntime.jsx("div",{className:"w-24 h-10 flex products-center justify-end ml-4",children:jsxRuntime.jsx(PartnerLogo,{id:e.ManufacturerId,name:e.ManufacturerName,width:96,height:40})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[e.State&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.State==="Active"?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(Check,{size:"12",className:"mr-1.5"})," ",e.State]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.SerialNumber?"bg-green-50 text-green-700 hover:bg-green-50":"bg-yellow-50 text-yellow-700 hover:bg-yellow-50"}`,children:[jsxRuntime.jsx(QrCode,{size:"12",className:"mr-1.5"})," ",e.SerialNumber?"Serialized":"Unserialized"]}),e.TransparencyCode&&jsxRuntime.jsxs(Badge,{variant:"outline",className:"rounded-full px-3 bg-green-50 text-green-700 hover:bg-green-50",children:[jsxRuntime.jsx(CircleDashed,{size:"12",className:"mr-1.5"})," Transparency Code"]}),e.AvailableToBuy!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.AvailableToBuy?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(ShoppingCart,{size:"12",className:"mr-1.5"})," ",e.AvailableToBuy?"Available":"Unavailable"]}),e.ManufacturerCategory!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${($t=e.ManufacturerCategory)!=null&&$t.QualificationRequired?"bg-blue-50 text-blue-700 hover:bg-blue-50":"bg-neutral-50 text-neutral-700 hover:bg-neutral-50"}`,children:[jsxRuntime.jsx(ShieldCheck,{size:"12",className:"mr-1.5"})," ",(Dt=e.ManufacturerCategory)!=null&&Dt.QualificationRequired?"Qualified Only":"Available to all"]}),e.ManufacturerId&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.AutoUpdate?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(RefreshCw,{size:"12",className:"mr-1.5"})," ",e.AutoUpdate?`Automatic Reorder (${e.MasterCarton})`:"Manually Reorders"]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.BodyHTML&&e.Title&&e.MAP?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(Store,{size:"12",className:"mr-1.5"})," ",e.BodyHTML&&e.Title&&e.MAP?"Shopify Ready":"Not Shopify Ready"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4 flex-1",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"MPN"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.MPN||"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"UPC"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.UPC||"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Unit Weight"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.UnitWeight?`${formatNumber(e.UnitWeight)} lbs`:"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"text-sm text-muted-foreground",children:["MAP",jsxRuntime.jsx("span",{className:"text-primary",children:" / "}),"MSRP"]}),jsxRuntime.jsxs("div",{className:"font-medium",children:[e.MAP?formatMoney(e.MAP):"N/A",jsxRuntime.jsx("span",{className:"text-primary",children:" / "}),e.MSRP?formatMoney(e.MSRP):"N/A"]})]}),!!e.OverallPercentileRank&&!!e.ManufacturerPercentileRank&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Percentile"}),jsxRuntime.jsxs("div",{className:`font-medium flex products-center ${e.OverallPercentileRank>=80?"text-green-700":""}`,children:[formatNumber(Math.round(e.OverallPercentileRank))," Overall"]}),jsxRuntime.jsxs("div",{className:"font-light flex products-center text-sm",children:[formatNumber(Math.round(e.ManufacturerPercentileRank))," with Manufacturer"]})]}),e.CountryCodeOfOrigin&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Origin"}),jsxRuntime.jsxs("div",{className:"font-medium flex products-center",children:[jsxRuntime.jsx(CountryFlag,{countryCode:e.CountryCodeOfOrigin,className:"mr-2"}),e.CountryCodeOfOrigin]})]})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col",children:jsxRuntime.jsx(ProductImage,{randmarSKU:e.RandmarSKU||"",alt:e.RandmarTitle||""})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsx("div",{className:"flex flex-1",children:qe&&e.Distribution&&jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx("div",{className:"flex products-center",children:"You have "+Be.length+(Be.length>1?" opportunities":" opportunity")+" for this product:"}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-[200px] overflow-y-auto p-2 mt-1",children:Be.map((Qe,dt)=>jsxRuntime.jsxs("div",{className:`flex justify-between products-center rounded-lg transition-colors py-2 px-4 bg-purple-100 border border-muted
1067
1067
  ${Qe.BidNumber==(E==null?void 0:E.BidNumber)?"cursor-pointer border-2 border-purple-900":Ve(Qe)?"hover:bg-purple-200 cursor-pointer":"!bg-neutral-50"}
1068
- `,onClick:()=>{Ve(Qe)&&A(Qe.BidNumber!=(E==null?void 0:E.BidNumber)?Qe:null)},children:[jsxRuntime.jsx("div",{className:"flex products-center",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"font-medium text-sm",children:Qe.Opportunity}),jsxRuntime.jsxs("span",{className:"text-xs text-neutral-900",children:[Qe.BidNumber," ",!Ve(Qe)&&jsxRuntime.jsx(Badge,{variant:"outline",className:"text-xs mx-1 h-5 bg-gray-100",children:"Currently unavailable"})]})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col products-end",children:[jsxRuntime.jsxs("span",{className:"font-semibold",children:["$",(pt=Qe.Price)==null?void 0:pt.toFixed(2)]}),Qe.Rebate&&Qe.Rebate>0&&jsxRuntime.jsxs("span",{className:"text-xs text-green-600",children:["Rebate: $",Qe.Rebate.toFixed(2)]}),Qe.EndDate&&jsxRuntime.jsxs("span",{className:"text-xs text-neutral-600",children:["Ends: ",Ze(Qe.EndDate)]})]})]},dt)})})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col products-center",children:[n&&jsxRuntime.jsx(reactRouterDom.Link,{to:n,children:jsxRuntime.jsxs(Button,{variant:"secondary",children:[jsxRuntime.jsx(Eye,{className:"mr-2"}),"View Product"]})}),((Ht=e.Distribution)==null?void 0:Ht.Inventory)&&jsxRuntime.jsx("div",{className:"mt-4",children:oe!=null&&oe.IsReseller&&et<=0?jsxRuntime.jsxs(Dialog,{open:F,onOpenChange:O,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:"flex products-center text-sm reseller-theme text-primary",children:[jsxRuntime.jsx(Warehouse,{size:"16",className:"mr-2"}),"Request to stock"]})}),jsxRuntime.jsxs(DialogContent,{className:"max-w-md",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsx(DialogTitle,{children:"Request to stock"})}),jsxRuntime.jsx("p",{className:"py-4",children:"Are you sure you want to request this product to be stocked?"}),jsxRuntime.jsxs("div",{className:"flex justify-end gap-2",children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>O(!1),disabled:z,children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:Ye,disabled:z,children:z?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin mr-2"}),"Requesting..."]}):"Confirm"})]})]})]}):et<=0&&ze>0?jsxRuntime.jsxs(Dialog,{open:j,onOpenChange:q,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:"flex products-center text-sm manufacturer-theme text-primary",children:[jsxRuntime.jsx(Warehouse,{size:"16",className:"mr-2"}),ze," Incoming"]})}),jsxRuntime.jsxs(DialogContent,{className:"max-w-4xl",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{className:"flex products-center",children:[jsxRuntime.jsx(Warehouse,{className:"mr-2",size:18}),"Inventory Information"]})}),jsxRuntime.jsx(ProductInventoryGrid,{inventory:e.Distribution.Inventory})]})]}):jsxRuntime.jsxs(Dialog,{open:j,onOpenChange:q,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:`flex products-center text-sm ${et>0?"text-green-700":"text-red-700"}`,children:[jsxRuntime.jsx(Warehouse,{size:"16",className:"mr-2"}),et>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[et," in stock"]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Out of stock"})]})}),jsxRuntime.jsxs(DialogContent,{className:"max-w-4xl",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{className:"flex products-center",children:[jsxRuntime.jsx(Warehouse,{className:"mr-2",size:18}),"Inventory Information"]})}),jsxRuntime.jsx(ProductInventoryGrid,{inventory:e.Distribution.Inventory})]})]})})]})]}),e.Distribution&&jsxRuntime.jsxs("div",{className:"flex justify-between products-end mt-4",children:[jsxRuntime.jsx("div",{className:"flex-shrink-1 flex flex-col products-start gap-1",children:Ae>0?jsxRuntime.jsx("div",{className:"flex products-center",children:jsxRuntime.jsxs("span",{className:"text-2xl font-bold whitespace-nowrap",children:[jsxRuntime.jsx("span",{children:"Cost: $"}),Ae.toFixed(2),jsxRuntime.jsx("span",{children:" CAD"})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex products-center flex-wrap",children:[jsxRuntime.jsxs("span",{className:"text-2xl font-bold whitespace-nowrap",children:[jsxRuntime.jsx("span",{children:"$"}),E?(We=(Vt=e.Opportunities)==null?void 0:Vt.find(Qe=>Qe.BidNumber==E.BidNumber))==null?void 0:We.Price:Fe.toFixed(2),jsxRuntime.jsx("span",{children:" CAD"})]}),I>0&&jsxRuntime.jsxs("span",{className:"text-muted-foreground line-through ml-2 whitespace-nowrap",children:["$",$e.toFixed(2)]})]}),I>0&&jsxRuntime.jsx("div",{className:"flex products-center",children:jsxRuntime.jsxs(Badge,{variant:"outline",className:"bg-red-50 text-red-700 rounded-full px-3 whitespace-nowrap",children:[jsxRuntime.jsxs("span",{children:[I,"% OFF"]}),((nt=e.InstantRebate)==null?void 0:nt.EndDate)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",e.InstantRebate.EndDate.split("T")[0]]}),(E==null?void 0:E.EndDate)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",E.EndDate.split("T")[0]]})]})})]})}),jsxRuntime.jsxs("div",{className:"flex flex-shrink-0 gap-2 ml-4",children:[typeof l<"u"&&jsxRuntime.jsxs("div",{className:"flex products-center border rounded-md",children:[jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"rounded-r-none",onClick:Ke,disabled:typeof R<"u"&&(R<=1||!e.AvailableToBuy||d),children:"-"}),jsxRuntime.jsx("input",{value:R,onChange:Xe,onBlur:tt,onClick:Qe=>Qe.currentTarget.select(),className:`w-12 text-center border-0 focus:ring-0 focus:outline-none ${!e.AvailableToBuy||d?"text-gray-400":""}`,disabled:!e.AvailableToBuy||d}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"rounded-l-none",onClick:He,disabled:!e.AvailableToBuy||d,children:"+"})]}),typeof l<"u"&&jsxRuntime.jsx(Button,{className:"gap-2 whitespace-nowrap",onClick:at,disabled:!e.AvailableToBuy||d,children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}),"Adding..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2"}),"Add to Cart"]})}),f&&jsxRuntime.jsx(Button,{className:"gap-2 whitespace-nowrap bg-green-600 hover:bg-green-700",onClick:rt,disabled:ne,children:ne?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2"}),"Sync to Shopify"]})}),g]})]})]})})}const complexComponents=[`----
1068
+ `,onClick:()=>{Ve(Qe)&&A(Qe.BidNumber!=(E==null?void 0:E.BidNumber)?Qe:null)},children:[jsxRuntime.jsx("div",{className:"flex products-center",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"font-medium text-sm",children:Qe.Opportunity}),jsxRuntime.jsxs("span",{className:"text-xs text-neutral-900",children:[Qe.BidNumber," ",!Ve(Qe)&&jsxRuntime.jsx(Badge,{variant:"outline",className:"text-xs mx-1 h-5 bg-gray-100",children:"Currently unavailable"})]})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col products-end",children:[jsxRuntime.jsx("span",{className:"font-semibold",children:formatMoney(Qe.Price??0)}),Qe.Rebate&&Qe.Rebate>0&&jsxRuntime.jsxs("span",{className:"text-xs text-green-600",children:["Rebate: ",formatMoney(Qe.Rebate)]}),Qe.EndDate&&jsxRuntime.jsxs("span",{className:"text-xs text-neutral-600",children:["Ends: ",Ze(Qe.EndDate)]})]})]},dt))})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col products-center",children:[n&&jsxRuntime.jsx(reactRouterDom.Link,{to:n,children:jsxRuntime.jsxs(Button,{variant:"secondary",children:[jsxRuntime.jsx(Eye,{className:"mr-2"}),"View Product"]})}),((Ht=e.Distribution)==null?void 0:Ht.Inventory)&&jsxRuntime.jsx("div",{className:"mt-4",children:oe!=null&&oe.IsReseller&&et<=0?jsxRuntime.jsxs(Dialog,{open:F,onOpenChange:O,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:"flex products-center text-sm reseller-theme text-primary",children:[jsxRuntime.jsx(Warehouse,{size:"16",className:"mr-2"}),"Request to stock"]})}),jsxRuntime.jsxs(DialogContent,{className:"max-w-md",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsx(DialogTitle,{children:"Request to stock"})}),jsxRuntime.jsx("p",{className:"py-4",children:"Are you sure you want to request this product to be stocked?"}),jsxRuntime.jsxs("div",{className:"flex justify-end gap-2",children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>O(!1),disabled:z,children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:Ye,disabled:z,children:z?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin mr-2"}),"Requesting..."]}):"Confirm"})]})]})]}):et<=0&&ze>0?jsxRuntime.jsxs(Dialog,{open:j,onOpenChange:q,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:"flex products-center text-sm manufacturer-theme text-primary",children:[jsxRuntime.jsx(Warehouse,{size:"16",className:"mr-2"}),formatNumber(ze)," Incoming"]})}),jsxRuntime.jsxs(DialogContent,{className:"max-w-4xl",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{className:"flex products-center",children:[jsxRuntime.jsx(Warehouse,{className:"mr-2",size:18}),"Inventory Information"]})}),jsxRuntime.jsx(ProductInventoryGrid,{inventory:e.Distribution.Inventory})]})]}):jsxRuntime.jsxs(Dialog,{open:j,onOpenChange:q,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:`flex products-center text-sm ${et>0?"text-green-700":"text-red-700"}`,children:[jsxRuntime.jsx(Warehouse,{size:"16",className:"mr-2"}),et>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[formatNumber(et)," in stock"]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Out of stock"})]})}),jsxRuntime.jsxs(DialogContent,{className:"max-w-4xl",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{className:"flex products-center",children:[jsxRuntime.jsx(Warehouse,{className:"mr-2",size:18}),"Inventory Information"]})}),jsxRuntime.jsx(ProductInventoryGrid,{inventory:e.Distribution.Inventory})]})]})})]})]}),e.Distribution&&jsxRuntime.jsxs("div",{className:"flex justify-between products-end mt-4",children:[jsxRuntime.jsx("div",{className:"flex-shrink-1 flex flex-col products-start gap-1",children:Ae>0?jsxRuntime.jsx("div",{className:"flex products-center",children:jsxRuntime.jsxs("span",{className:"text-2xl font-bold whitespace-nowrap",children:["Cost: ",formatMoney(Ae)]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex products-center flex-wrap",children:[jsxRuntime.jsx("span",{className:"text-2xl font-bold whitespace-nowrap",children:formatMoney((E?(We=(Vt=e.Opportunities)==null?void 0:Vt.find(Qe=>Qe.BidNumber==E.BidNumber))==null?void 0:We.Price:Fe)??0)}),I>0&&jsxRuntime.jsx("span",{className:"text-muted-foreground line-through ml-2 whitespace-nowrap",children:formatMoney($e)})]}),I>0&&jsxRuntime.jsx("div",{className:"flex products-center",children:jsxRuntime.jsxs(Badge,{variant:"outline",className:"bg-red-50 text-red-700 rounded-full px-3 whitespace-nowrap",children:[jsxRuntime.jsxs("span",{children:[I,"% OFF"]}),((nt=e.InstantRebate)==null?void 0:nt.EndDate)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",e.InstantRebate.EndDate.split("T")[0]]}),(E==null?void 0:E.EndDate)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",E.EndDate.split("T")[0]]})]})})]})}),jsxRuntime.jsxs("div",{className:"flex flex-shrink-0 gap-2 ml-4",children:[typeof l<"u"&&jsxRuntime.jsxs("div",{className:"flex products-center border rounded-md",children:[jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"rounded-r-none",onClick:Ke,disabled:typeof R<"u"&&(R<=1||!e.AvailableToBuy||d),children:"-"}),jsxRuntime.jsx("input",{value:R,onChange:Xe,onBlur:tt,onClick:Qe=>Qe.currentTarget.select(),className:`w-12 text-center border-0 focus:ring-0 focus:outline-none ${!e.AvailableToBuy||d?"text-gray-400":""}`,disabled:!e.AvailableToBuy||d}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"rounded-l-none",onClick:He,disabled:!e.AvailableToBuy||d,children:"+"})]}),typeof l<"u"&&jsxRuntime.jsx(Button,{className:"gap-2 whitespace-nowrap",onClick:at,disabled:!e.AvailableToBuy||d,children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}),"Adding..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2"}),"Add to Cart"]})}),f&&jsxRuntime.jsx(Button,{className:"gap-2 whitespace-nowrap bg-green-600 hover:bg-green-700",onClick:rt,disabled:ne,children:ne?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2"}),"Sync to Shopify"]})}),g]})]})]})})}const complexComponents=[`----
1069
1069
  PartnerCard: For data that fits this shape:
1070
1070
  { "ApplicationId": "19022", "PublicName": "BiOSS", "VoiceName": null, "VoiceStyle": null, "About": "example", "SceneName": "Kitchen Counter", "IsReseller": true, "IsManufacturer": true, "IsSalesAgency": false, "Socials": [ { "ApplicationId": "19022", "SocialNetwork": "Facebook", "Tag": "@bioss.ca" }, { "ApplicationId": "19022", "SocialNetwork": "Instagram", "Tag": "@bioss.ca" }, { "ApplicationId": "19022", "SocialNetwork": "LinkedIn", "Tag": "@biossinc" }, { "ApplicationId": "19022", "SocialNetwork": "Youtube", "Tag": "@biosssolutionssanitairessa4095" } ], "Manufacturer": null, "Reseller": null }
1071
1071
  Use <PartnerCard account={data} action={<></>}>`,`----
@@ -1083,7 +1083,7 @@ Defaulting to 2020, but this will stop working in the future.`)),e.ecmaVersion=1
1083
1083
  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
1084
1084
  `),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}=useApiKey();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,I]=React__namespace.useState(null),[M,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:I,name:g,form:f,value:S,hasConsumerStoppedPropagationRef:q,required:_,defaultChecked:isIndeterminate(l)?!1:l,isFormControl:z,bubbleInput:M,setBubbleInput:j};return jsxRuntime.jsx(CheckboxProviderImpl,{scope:e,...Q,children:isFunction$3(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),I=useComposedRefs(l,S),M=React__namespace.useRef(b);return React__namespace.useEffect(()=>{const j=d==null?void 0:d.form;if(j){const q=()=>R(M.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:I,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$1="CheckboxIndicator",CheckboxIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:o,...l}=t,d=useCheckboxContext(INDICATOR_NAME$1,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$1;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),I=usePrevious(d),M=useSize(o);React__namespace.useEffect(()=>{const q=C;if(!q)return;const z=window.HTMLInputElement.prototype,F=Object.getOwnPropertyDescriptor(z,"checked").set,O=!l.current;if(I!==d&&F){const te=new Event("click",{bubbles:O});q.indeterminate=isIndeterminate(d),F.call(q,isIndeterminate(d)?!1:d),q.dispatchEvent(te)}},[C,I,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,...M,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});CheckboxBubbleInput.displayName=BUBBLE_INPUT_NAME$1;function isFunction$3(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,Xe;return{search:"",value:(Xe=(He=t.value)!=null?He:t.defaultValue)!=null?Xe:"",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:I=!1,vimBindings:M=!0,...j}=t,q=useId(),z=useId(),Q=useId(),F=React__namespace.useRef(null),O=ke();k(()=>{if(S!==void 0){let He=S.trim();n.current.value=He,te.emit()}},[S]),k(()=>{O(6,Ne)},[]);let te=React__namespace.useMemo(()=>({subscribe:He=>(f.current.add(He),()=>f.current.delete(He)),snapshot:()=>n.current,setState:(He,Xe,tt)=>{var Ye,et,Ze,at;if(!Object.is(n.current[He],Xe)){if(n.current[He]=Xe,He==="search")je(),ge(),O(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(O(7,()=>{var rt;n.current.selectedItemId=(rt=Ae())==null?void 0:rt.id,te.emit()}),tt||O(5,Ne),((et=g.current)==null?void 0:et.value)!==void 0){let rt=Xe??"";(at=(Ze=g.current).onValueChange)==null||at.call(Ze,rt);return}}te.emit()}},emit:()=>{f.current.forEach(He=>He())}}),[]),ne=React__namespace.useMemo(()=>({value:(He,Xe,tt)=>{var Ye;Xe!==((Ye=d.current.get(He))==null?void 0:Ye.value)&&(d.current.set(He,{value:Xe,keywords:tt}),n.current.filtered.items.set(He,ae(Xe,tt)),O(2,()=>{ge(),te.emit()}))},item:(He,Xe)=>(o.current.add(He),Xe&&(l.current.has(Xe)?l.current.get(Xe).add(He):l.current.set(Xe,new Set([He]))),O(3,()=>{je(),ge(),n.current.value||oe(),te.emit()}),()=>{d.current.delete(He),o.current.delete(He),n.current.filtered.items.delete(He);let tt=Ae();O(4,()=>{je(),(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 ae(He,Xe){var tt,Ye;let et=(Ye=(tt=g.current)==null?void 0:tt.filter)!=null?Ye:Re;return He?et(He,n.current.search,Xe):0}function ge(){if(!n.current.search||g.current.shouldFilter===!1)return;let He=n.current.filtered.items,Xe=[];n.current.filtered.groups.forEach(Ye=>{let et=l.current.get(Ye),Ze=0;et.forEach(at=>{let rt=He.get(at);Ze=Math.max(rt,Ze)}),Xe.push([Ye,Ze])});let tt=F.current;$e().sort((Ye,et)=>{var Ze,at;let rt=Ye.getAttribute("id"),it=et.getAttribute("id");return((Ze=He.get(it))!=null?Ze:0)-((at=He.get(rt))!=null?at:0)}).forEach(Ye=>{let et=Ye.closest(Y);et?et.appendChild(Ye.parentElement===et?Ye:Ye.closest(`${Y} > *`)):tt.appendChild(Ye.parentElement===tt?Ye:Ye.closest(`${Y} > *`))}),Xe.sort((Ye,et)=>et[1]-Ye[1]).forEach(Ye=>{var et;let Ze=(et=F.current)==null?void 0:et.querySelector(`${N}[${T}="${encodeURIComponent(Ye[0])}"]`);Ze==null||Ze.parentElement.appendChild(Ze)})}function oe(){let He=$e().find(tt=>tt.getAttribute("aria-disabled")!=="true"),Xe=He==null?void 0:He.getAttribute(T);te.setState("value",Xe||void 0)}function je(){var He,Xe,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 et=0;for(let Ze of o.current){let at=(Xe=(He=d.current.get(Ze))==null?void 0:He.value)!=null?Xe:"",rt=(Ye=(tt=d.current.get(Ze))==null?void 0:tt.keywords)!=null?Ye:[],it=ae(at,rt);n.current.filtered.items.set(Ze,it),it>0&&et++}for(let[Ze,at]of l.current)for(let rt of at)if(n.current.filtered.items.get(rt)>0){n.current.filtered.groups.add(Ze);break}n.current.filtered.count=et}function Ne(){var He,Xe,tt;let Ye=Ae();Ye&&(((He=Ye.parentElement)==null?void 0:He.firstChild)===Ye&&((tt=(Xe=Ye.closest(N))==null?void 0:Xe.querySelector(be))==null||tt.scrollIntoView({block:"nearest"})),Ye.scrollIntoView({block:"nearest"}))}function Ae(){var He;return(He=F.current)==null?void 0:He.querySelector(`${le}[aria-selected="true"]`)}function $e(){var He;return Array.from(((He=F.current)==null?void 0:He.querySelectorAll(ce))||[])}function Fe(He){let Xe=$e()[He];Xe&&te.setState("value",Xe.getAttribute(T))}function ze(He){var Xe;let tt=Ae(),Ye=$e(),et=Ye.findIndex(at=>at===tt),Ze=Ye[et+He];(Xe=g.current)!=null&&Xe.loop&&(Ze=et+He<0?Ye[Ye.length-1]:et+He===Ye.length?Ye[0]:Ye[et+He]),Ze&&te.setState("value",Ze.getAttribute(T))}function Ve(He){let Xe=Ae(),tt=Xe==null?void 0:Xe.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($e().length-1),qe=He=>{He.preventDefault(),He.metaKey?Be():He.altKey?Ve(1):ze(1)},Ke=He=>{He.preventDefault(),He.metaKey?Fe(0):He.altKey?Ve(-1):ze(-1)};return React__namespace.createElement(Primitive.div,{ref:e,tabIndex:-1,...j,"cmdk-root":"",onKeyDown:He=>{var Xe;(Xe=j.onKeyDown)==null||Xe.call(j,He);let tt=He.nativeEvent.isComposing||He.keyCode===229;if(!(He.defaultPrevented||tt))switch(He.key){case"n":case"j":{M&&He.ctrlKey&&qe(He);break}case"ArrowDown":{qe(He);break}case"p":case"k":{M&&He.ctrlKey&&Ke(He);break}case"ArrowUp":{Ke(He);break}case"Home":{He.preventDefault(),Fe(0);break}case"End":{He.preventDefault(),Be();break}case"Enter":{He.preventDefault();let Ye=Ae();if(Ye){let et=new Event(Z);Ye.dispatchEvent(et)}}}}},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(O=>O.value&&O.value===S.current),E=P(O=>_||g.filter()===!1?!0:O.search?O.filtered.items.get(l)>0:!0);React__namespace.useEffect(()=>{let O=d.current;if(!(!O||t.disabled))return O.addEventListener(Z,A),()=>O.removeEventListener(Z,A)},[E,t.onSelect,t.disabled]);function A(){var O,te;I(),(te=(O=b.current).onSelect)==null||te.call(O,S.current)}function I(){R.setState("value",S.current,!0)}if(!E)return null;let{disabled:M,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":!!M,"aria-selected":!!C,"data-disabled":!!M,"data-selected":!!C,onPointerMove:M||g.getDisablePointerSelection()?void 0:I,onClick:M?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,chatApiKey:d,appID:f},g)=>{const b=t.filter(C=>C.showInNav),_=React.useRef(null),S=React.useRef(null),R=React.useRef(null);return React.useImperativeHandle(g,()=>({setActiveChatAndSendMessage:(C,E)=>{var A;return(A=R.current)==null||A.click(),setTimeout(()=>{var I;(I=_.current)==null||I.focus(),S.current&&S.current.setActiveChatAndSendMessage(C,E)},100),!0}})),jsxRuntime.jsxs(Sidebar,{className:"border-r border-sidebar-border",children:[jsxRuntime.jsx(SidebarHeader,{className:"border-b border-sidebar-border px-6 h-16 justify-center bg-sidebar text-sidebar-foreground",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center",children:jsxRuntime.jsx("img",{src:"https://api.randmar.io/images/RandmarIcon.svg",alt:"Randmar Icon",className:"h-4 w-4 filter brightness-0 saturate-100 invert"})}),jsxRuntime.jsx("span",{className:"font-semibold text-lg",children:n})]})}),jsxRuntime.jsx(SidebarContent,{className:"py-4 bg-sidebar text-sidebar-foreground",children:jsxRuntime.jsx(SidebarMenu,{children:b.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.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{ref:R,size:"lg",className:"collapse md:visible",onClick:()=>setTimeout(()=>{var C;return(C=_.current)==null?void 0:C.focus()},50),children:[jsxRuntime.jsx(Bot,{}),"Assistant"]})}),jsxRuntime.jsx(DialogContent,{className:"max-w-[85vw] p-0 data-[state=open]:visible data-[state=closed]:invisible",forceMount:!0,animateExit:!1,children:jsxRuntime.jsx(ChatLayout,{ref:S,inputRef:_,userId:f,userName:l??"Unknown user",apiKey:d??""})})]}),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,chatApiKey:R,chatRef:C},E)=>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,chatApiKey:R,ref:C}),jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col",children:[jsxRuntime.jsx(Topbar,{ref:E,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),[I,M]=React.useState(""),[j,q]=React.useState(""),[z,Q]=React.useState([]),[F,O]=React.useState(""),[te,ne]=React.useState(""),[ae,ge]=React.useState([]),[oe,je]=React.useState(""),[Ne,Ae]=React.useState(""),[$e]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),{sendMessage:Fe}=useChat(),ze=()=>{S(""),C("")},Ve=()=>{M(""),q(""),Q([]),O(""),ne(""),ge([]),je(""),Ae("")},Be=()=>{e.PartnerRegistrationLink?l(!0):e.OpenToWork&&f(!0)},qe=et=>{if(et.preventDefault(),!g){if(!_.trim()){C("Qualification ID is required");return}b(!0),$e({routeApplicationId:t,partnerId:e.ManufacturerId??"",message:`Hello! I'd like to get started with you. Here's my Qualification ID: ${_}`}).then(Ze=>{var rt;if(Ze.error){console.error(Ze.error),n({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"});return}const at=(rt=Ze.data)==null?void 0:rt.ConversationId;at&&Fe(at)?(l(!1),ze()):n({title:"Could not send message",description:"Try again later.",variant:"destructive"})}).catch(Ze=>{console.error(Ze),n({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"})}).finally(()=>{b(!1)})}},Ke=et=>{if(et.preventDefault(),E)return;q(""),O(""),je("");let Ze=!1;if(I.trim().length<10&&(q("Please provide a brief description of your business (minimum 10 characters)"),Ze=!0),z.length===0&&(O("Please select at least one sales channel"),Ze=!0),ae.length===0&&(je("Please select at least one market"),Ze=!0),Ze)return;const at=salesChannels.filter(st=>z.includes(st.id)).map(st=>st.label);te&&at.push(`Other: ${te}`);const rt=markets.filter(st=>ae.includes(st.id)).map(st=>st.label);Ne&&rt.push(`Other: ${Ne}`);const it=["Hello! I'd like to introduce my business:",`Business Description: ${I}`,`Sales Channels: ${at.join(", ")}`,`Markets: ${rt.join(", ")}`].join(`
1085
1085
 
1086
- `);A(!0),$e({routeApplicationId:t,partnerId:e.ManufacturerId??"",message:it}).then(st=>{var Rt;if(st.error){console.error(st.error),n({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"});return}const Ue=(Rt=st.data)==null?void 0:Rt.ConversationId;Ue&&Fe(Ue)?(f(!1),Ve()):n({title:"Could not send message",description:"Try again later.",variant:"destructive"})}).catch(st=>{console.error(st),n({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"})}).finally(()=>{A(!1)})},He=(et,Ze)=>{Q(at=>Ze?[...at,et]:at.filter(rt=>rt!==et)),O("")},Xe=(et,Ze)=>{ge(at=>Ze?[...at,et]:at.filter(rt=>rt!==et)),je("")},tt=z.includes("other-channel"),Ye=ae.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:et=>{l(et)},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:et=>{S(et.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:et=>{f(et)},children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[768px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsx(DialogTitle,{children:"Introduce Yourself"})}),jsxRuntime.jsxs("form",{onSubmit:Ke,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:I,onChange:et=>{M(et.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(et=>jsxRuntime.jsxs("div",{className:"flex items-start space-x-2",children:[jsxRuntime.jsx(Checkbox,{id:`channel-${et.id}`,checked:z.includes(et.id),onCheckedChange:Ze=>He(et.id,Ze===!0)}),jsxRuntime.jsx(Label$2,{htmlFor:`channel-${et.id}`,className:"text-sm font-normal",children:et.label})]},et.id))}),tt&&jsxRuntime.jsx(Input,{placeholder:"Please specify",value:te,onChange:et=>ne(et.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(et=>jsxRuntime.jsxs("div",{className:"flex items-start space-x-2",children:[jsxRuntime.jsx(Checkbox,{id:`market-${et.id}`,checked:ae.includes(et.id),onCheckedChange:Ze=>Xe(et.id,Ze===!0)}),jsxRuntime.jsx(Label$2,{htmlFor:`market-${et.id}`,className:"text-sm font-normal",children:et.label})]},et.id))}),Ye&&jsxRuntime.jsx(Input,{placeholder:"Please specify",value:Ne,onChange:et=>Ae(et.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,I=usePopperScope$1(e),[M,j]=React__namespace.useState(null),[q,z]=React__namespace.useState(null),[Q,F]=React__namespace.useState(!1),O=useDirection(_),[te,ne]=useControllableState({prop:o,defaultProp:l??!1,onChange:d,caller:SELECT_NAME}),[ae,ge]=useControllableState({prop:f,defaultProp:g,onChange:b,caller:SELECT_NAME}),oe=React__namespace.useRef(null),je=M?A||!!M.closest("form"):!0,[Ne,Ae]=React__namespace.useState(new Set),$e=Array.from(Ne).map(Fe=>Fe.props.value).join(";");return jsxRuntime.jsx(Root2$6,{...I,children:jsxRuntime.jsxs(SelectProvider,{required:E,scope:e,trigger:M,onTriggerChange:j,valueNode:q,onValueNodeChange:z,valueNodeHasChildren:Q,onValueNodeHasChildrenChange:F,contentId:useId(),value:ae,onValueChange:ge,open:te,onOpenChange:ne,dir:O,triggerPointerDownPosRef:oe,disabled:C,children:[jsxRuntime.jsx(Collection.Provider,{scope:e,children:jsxRuntime.jsx(SelectNativeOptionsProvider,{scope:t.__scopeSelect,onNativeOptionAdd:React__namespace.useCallback(Fe=>{Ae(ze=>new Set(ze).add(Fe))},[]),onNativeOptionRemove:React__namespace.useCallback(Fe=>{Ae(ze=>{const Ve=new Set(ze);return Ve.delete(Fe),Ve})},[]),children:n})}),je?jsxRuntime.jsxs(SelectBubbleInput,{"aria-hidden":!0,required:E,tabIndex:-1,name:S,autoComplete:R,value:ae,onChange:Fe=>ge(Fe.target.value),disabled:C,form:A,children:[ae===void 0?jsxRuntime.jsx("option",{value:""}):null,Array.from(Ne)]},$e):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(I=>{const M=_().filter(z=>!z.disabled),j=M.find(z=>z.value===f.value),q=findNextItem(M,I,j);q!==void 0&&f.onValueChange(q.value)}),A=I=>{g||(f.onOpenChange(!0),E()),I&&(f.triggerPointerDownPosRef.current={x:Math.round(I.pageX),y:Math.round(I.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,I=>{I.currentTarget.focus(),S.current!=="mouse"&&A(I)}),onPointerDown:composeEventHandlers(l.onPointerDown,I=>{S.current=I.pointerType;const M=I.target;M.hasPointerCapture(I.pointerId)&&M.releasePointerCapture(I.pointerId),I.button===0&&I.ctrlKey===!1&&I.pointerType==="mouse"&&(A(I),I.preventDefault())}),onKeyDown:composeEventHandlers(l.onKeyDown,I=>{const M=R.current!=="";!(I.ctrlKey||I.altKey||I.metaKey)&&I.key.length===1&&C(I.key),!(M&&I.key===" ")&&OPEN_KEYS.includes(I.key)&&(A(),I.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:I,avoidCollisions:M,...j}=t,q=useSelectContext(CONTENT_NAME$2,n),[z,Q]=React__namespace.useState(null),[F,O]=React__namespace.useState(null),te=useComposedRefs(e,Ze=>Q(Ze)),[ne,ae]=React__namespace.useState(null),[ge,oe]=React__namespace.useState(null),je=useCollection(n),[Ne,Ae]=React__namespace.useState(!1),$e=React__namespace.useRef(!1);React__namespace.useEffect(()=>{if(z)return hideOthers(z)},[z]),useFocusGuards();const Fe=React__namespace.useCallback(Ze=>{const[at,...rt]=je().map(Ue=>Ue.ref.current),[it]=rt.slice(-1),st=document.activeElement;for(const Ue of Ze)if(Ue===st||(Ue==null||Ue.scrollIntoView({block:"nearest"}),Ue===at&&F&&(F.scrollTop=0),Ue===it&&F&&(F.scrollTop=F.scrollHeight),Ue==null||Ue.focus(),document.activeElement!==st))return},[je,F]),ze=React__namespace.useCallback(()=>Fe([ne,z]),[Fe,ne,z]);React__namespace.useEffect(()=>{Ne&&ze()},[Ne,ze]);const{onOpenChange:Ve,triggerPointerDownPosRef:Be}=q;React__namespace.useEffect(()=>{if(z){let Ze={x:0,y:0};const at=it=>{var st,Ue;Ze={x:Math.abs(Math.round(it.pageX)-(((st=Be.current)==null?void 0:st.x)??0)),y:Math.abs(Math.round(it.pageY)-(((Ue=Be.current)==null?void 0:Ue.y)??0))}},rt=it=>{Ze.x<=10&&Ze.y<=10?it.preventDefault():z.contains(it.target)||Ve(!1),document.removeEventListener("pointermove",at),Be.current=null};return Be.current!==null&&(document.addEventListener("pointermove",at),document.addEventListener("pointerup",rt,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",at),document.removeEventListener("pointerup",rt,{capture:!0})}}},[z,Ve,Be]),React__namespace.useEffect(()=>{const Ze=()=>Ve(!1);return window.addEventListener("blur",Ze),window.addEventListener("resize",Ze),()=>{window.removeEventListener("blur",Ze),window.removeEventListener("resize",Ze)}},[Ve]);const[qe,Ke]=useTypeaheadSearch(Ze=>{const at=je().filter(st=>!st.disabled),rt=at.find(st=>st.ref.current===document.activeElement),it=findNextItem(at,Ze,rt);it&&setTimeout(()=>it.ref.current.focus())}),He=React__namespace.useCallback((Ze,at,rt)=>{const it=!$e.current&&!rt;(q.value!==void 0&&q.value===at||it)&&(ae(Ze),it&&($e.current=!0))},[q.value]),Xe=React__namespace.useCallback(()=>z==null?void 0:z.focus(),[z]),tt=React__namespace.useCallback((Ze,at,rt)=>{const it=!$e.current&&!rt;(q.value!==void 0&&q.value===at||it)&&oe(Ze)},[q.value]),Ye=o==="popper"?SelectPopperPosition:SelectItemAlignedPosition,et=Ye===SelectPopperPosition?{side:g,sideOffset:b,align:_,alignOffset:S,arrowPadding:R,collisionBoundary:C,collisionPadding:E,sticky:A,hideWhenDetached:I,avoidCollisions:M}:{};return jsxRuntime.jsx(SelectContentProvider,{scope:n,content:z,viewport:F,onViewportChange:O,itemRefCallback:He,selectedItem:ne,onItemLeave:Xe,itemTextRefCallback:tt,focusSelectedItem:ze,selectedItemText:ge,position:o,isPositioned:Ne,searchRef:qe,children:jsxRuntime.jsx(ReactRemoveScroll,{as:Slot$1,allowPinchZoom:!0,children:jsxRuntime.jsx(FocusScope,{asChild:!0,trapped:q.open,onMountAutoFocus:Ze=>{Ze.preventDefault()},onUnmountAutoFocus:composeEventHandlers(l,Ze=>{var at;(at=q.trigger)==null||at.focus({preventScroll:!0}),Ze.preventDefault()}),children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:Ze=>Ze.preventDefault(),onDismiss:()=>q.onOpenChange(!1),children:jsxRuntime.jsx(Ye,{role:"listbox",id:q.contentId,"data-state":q.open?"open":"closed",dir:q.dir,onContextMenu:Ze=>Ze.preventDefault(),...j,...et,onPlaced:()=>Ae(!0),ref:te,style:{display:"flex",flexDirection:"column",outline:"none",...j.style},onKeyDown:composeEventHandlers(j.onKeyDown,Ze=>{const at=Ze.ctrlKey||Ze.altKey||Ze.metaKey;if(Ze.key==="Tab"&&Ze.preventDefault(),!at&&Ze.key.length===1&&Ke(Ze.key),["ArrowUp","ArrowDown","Home","End"].includes(Ze.key)){let it=je().filter(st=>!st.disabled).map(st=>st.ref.current);if(["ArrowUp","End"].includes(Ze.key)&&(it=it.slice().reverse()),["ArrowUp","ArrowDown"].includes(Ze.key)){const st=Ze.target,Ue=it.indexOf(st);it=it.slice(Ue+1)}setTimeout(()=>Fe(it)),Ze.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:I,selectedItem:M,selectedItemText:j,focusSelectedItem:q}=f,z=React__namespace.useCallback(()=>{if(d.trigger&&d.valueNode&&g&&_&&I&&M&&j){const te=d.trigger.getBoundingClientRect(),ne=_.getBoundingClientRect(),ae=d.valueNode.getBoundingClientRect(),ge=j.getBoundingClientRect();if(d.dir!=="rtl"){const st=ge.left-ne.left,Ue=ae.left-st,Rt=te.left-Ue,Je=te.width+Rt,mt=Math.max(Je,ne.width),$t=window.innerWidth-CONTENT_MARGIN,Dt=clamp(Ue,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,$t-mt)]);g.style.minWidth=Je+"px",g.style.left=Dt+"px"}else{const st=ne.right-ge.right,Ue=window.innerWidth-ae.right-st,Rt=window.innerWidth-te.right-Ue,Je=te.width+Rt,mt=Math.max(Je,ne.width),$t=window.innerWidth-CONTENT_MARGIN,Dt=clamp(Ue,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,$t-mt)]);g.style.minWidth=Je+"px",g.style.right=Dt+"px"}const oe=C(),je=window.innerHeight-CONTENT_MARGIN*2,Ne=I.scrollHeight,Ae=window.getComputedStyle(_),$e=parseInt(Ae.borderTopWidth,10),Fe=parseInt(Ae.paddingTop,10),ze=parseInt(Ae.borderBottomWidth,10),Ve=parseInt(Ae.paddingBottom,10),Be=$e+Fe+Ne+Ve+ze,qe=Math.min(M.offsetHeight*5,Be),Ke=window.getComputedStyle(I),He=parseInt(Ke.paddingTop,10),Xe=parseInt(Ke.paddingBottom,10),tt=te.top+te.height/2-CONTENT_MARGIN,Ye=je-tt,et=M.offsetHeight/2,Ze=M.offsetTop+et,at=$e+Fe+Ze,rt=Be-at;if(at<=tt){const st=oe.length>0&&M===oe[oe.length-1].ref.current;g.style.bottom="0px";const Ue=_.clientHeight-I.offsetTop-I.offsetHeight,Rt=Math.max(Ye,et+(st?Xe:0)+Ue+ze),Je=at+Rt;g.style.height=Je+"px"}else{const st=oe.length>0&&M===oe[0].ref.current;g.style.top="0px";const Rt=Math.max(tt,$e+I.offsetTop+(st?He:0)+et)+rt;g.style.height=Rt+"px",I.scrollTop=at-tt+I.offsetTop}g.style.margin=`${CONTENT_MARGIN}px 0`,g.style.minHeight=qe+"px",g.style.maxHeight=je+"px",o==null||o(),requestAnimationFrame(()=>E.current=!0)}},[C,d.trigger,d.valueNode,g,_,I,M,j,d.dir,o]);useLayoutEffect2(()=>z(),[z]);const[Q,F]=React__namespace.useState();useLayoutEffect2(()=>{_&&F(window.getComputedStyle(_).zIndex)},[_]);const O=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:O,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,I=parseFloat(R.style.minHeight),M=parseFloat(R.style.height),j=Math.max(I,M);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)}),I=useId(),M=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:I,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":I,"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,()=>{M.current!=="mouse"&&j()}),onPointerUp:composeEventHandlers(f.onPointerUp,()=>{M.current==="mouse"&&j()}),onPointerDown:composeEventHandlers(f.onPointerDown,q=>{M.current=q.pointerType}),onPointerMove:composeEventHandlers(f.onPointerMove,q=>{var z;M.current=q.pointerType,l?(z=b.onItemLeave)==null||z.call(b):M.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:I,onNativeOptionRemove:M}=_;return useLayoutEffect2(()=>(I(A),()=>M(A)),[I,M,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],I=j=>j==="ASAP"?-1:DAYS_OF_WEEK.indexOf(j),M=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",I(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||!M,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=M=>{n(e.filter(j=>j!==M))},A=M=>{f(!1),e.includes(M)?n(e.filter(j=>j!==M)):n([...e,M])},I=M=>{M.key==="Enter"&&g&&!t.includes(g)&&!e.includes(g)&&(M.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(M=>jsxRuntime.jsxs(Badge,{variant:"outline",className:"mr-1 mb-1",children:[M,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(M)},children:jsxRuntime.jsx(X$1,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},M)):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:I,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(M=>!e.includes(M)).map(M=>jsxRuntime.jsxs(CommandItem,{onSelect:()=>A(M),children:[jsxRuntime.jsx(Check,{className:cn("mr-2 h-4 w-4",e.includes(M)?"opacity-100":"opacity-0")}),M]},M)),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`,I=React.useRef(null),M=useIntersectionObserver({elementRef:I,threshold:.1,rootMargin:"100px"});React__namespace.useEffect(()=>{const F=async()=>{try{const te=await(await fetch(A+"/Exists")).json();g(te)}catch(O){console.error("Error checking for video:",O),g(!1)}};M&&!b&&(_(!0),F())},[t,A,M,b]);async function j(){if(f){E(!0);try{const O=await(await fetch(A)).blob(),te=window.URL.createObjectURL(O),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:I,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=f=>f===void 0?"$0.00":new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:2}).format(f),o=t.Statement||{},l=[{title:"0 - 30 Days",amount:o.Over0||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"},{title:"31 - 45 Days",amount:o.Over30||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"},{title:"45+ Days",amount:o.Over45||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"}],d=[{title:"Total",amount:o.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:l.map((f,g)=>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:f.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${f.color}`,children:f.icon})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("p",{className:"text-base sm:text-lg font-bold",children:n(f.amount)})})]},g))}),jsxRuntime.jsx("div",{className:"space-y-4",children:d.map((f,g)=>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:f.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${f.color}`,children:f.icon})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("p",{className:"text-base sm:text-lg font-bold",children:n(f.amount)})})]},g))})]}),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=d=>new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:2}).format(d),o=[{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"}],l=React.useMemo(()=>{const d=new Map;return e.forEach(f=>{var b;const g=((b=f.Day)==null?void 0:b.toString())||"";if(g.length===8){const _=parseInt(g.substring(0,4),10),S=parseInt(g.substring(4,6),10)-1,R=parseInt(g.substring(6,8),10),C=new Date(_,S,R),E=new Date(C),A=C.getDay();E.setDate(C.getDate()-A);const I=`${E.getFullYear()}-${String(E.getMonth()+1).padStart(2,"0")}-${String(E.getDate()).padStart(2,"0")}`,M=f.ExtendedPrice||0;d.has(I)?d.set(I,d.get(I)+M):d.set(I,M)}}),Array.from(d).sort(([f],[g])=>f.localeCompare(g)).map(([f,g])=>({date:`${f.substring(5,7)}/${f.substring(8,10)}`,amount:g}))},[e]);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:o.map((d,f)=>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:d.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${d.color}`,children:d.icon})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base @sm:text-lg font-bold",children:n(d.amount)})]})]},f))}),jsxRuntime.jsx("div",{className:"mt-6",children:e&&e.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("h3",{className:"text-sm font-medium mb-4",children:"Sales Trend"}),jsxRuntime.jsx("div",{className:"space-y-6",children:jsxRuntime.jsx(AreaChart,{data:l,units:"$",unitsPosition:"left",height:200})})]})})]})]})}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$2=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$2(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$2(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:I,valueAsNumber:M,mount:j}=t._f,q=get(n,I);if(!j||e.has(I))return{};const z=g?g[0]:f,Q=je=>{l&&z.reportValidity&&(z.setCustomValidity(isBoolean(je)?"":je||""),z.reportValidity())},F={},O=isRadioInput(f),te=isCheckBoxInput(f),ne=O||te,ae=(M||isFileInput(f))&&isUndefined(f.value)&&isUndefined(q)||isHTMLElement(f)&&f.value===""||q===""||Array.isArray(q)&&!q.length,ge=appendErrors.bind(null,I,o,F),oe=(je,Ne,Ae,$e=INPUT_VALIDATION_RULES.maxLength,Fe=INPUT_VALIDATION_RULES.minLength)=>{const ze=je?Ne:Ae;F[I]={type:je?$e:Fe,message:ze,ref:f,...ge(je?$e:Fe,ze)}};if(d?!Array.isArray(q)||!q.length:b&&(!ne&&(ae||isNullOrUndefined(q))||isBoolean(q)&&!q||te&&!getCheckboxValue(g).isValid||O&&!getRadioValue(g).isValid)){const{value:je,message:Ne}=isMessage(b)?{value:!!b,message:b}:getValueAndMessage(b);if(je&&(F[I]={type:INPUT_VALIDATION_RULES.required,message:Ne,ref:z,...ge(INPUT_VALIDATION_RULES.required,Ne)},!o))return Q(Ne),F}if(!ae&&(!isNullOrUndefined(R)||!isNullOrUndefined(C))){let je,Ne;const Ae=getValueAndMessage(C),$e=getValueAndMessage(R);if(!isNullOrUndefined(q)&&!isNaN(q)){const Fe=f.valueAsNumber||q&&+q;isNullOrUndefined(Ae.value)||(je=Fe>Ae.value),isNullOrUndefined($e.value)||(Ne=Fe<$e.value)}else{const Fe=f.valueAsDate||new Date(q),ze=qe=>new Date(new Date().toDateString()+" "+qe),Ve=f.type=="time",Be=f.type=="week";isString(Ae.value)&&q&&(je=Ve?ze(q)>ze(Ae.value):Be?q>Ae.value:Fe>new Date(Ae.value)),isString($e.value)&&q&&(Ne=Ve?ze(q)<ze($e.value):Be?q<$e.value:Fe<new Date($e.value))}if((je||Ne)&&(oe(!!je,Ae.message,$e.message,INPUT_VALIDATION_RULES.max,INPUT_VALIDATION_RULES.min),!o))return Q(F[I].message),F}if((_||S)&&!ae&&(isString(q)||d&&Array.isArray(q))){const je=getValueAndMessage(_),Ne=getValueAndMessage(S),Ae=!isNullOrUndefined(je.value)&&q.length>+je.value,$e=!isNullOrUndefined(Ne.value)&&q.length<+Ne.value;if((Ae||$e)&&(oe(Ae,je.message,Ne.message),!o))return Q(F[I].message),F}if(E&&!ae&&isString(q)){const{value:je,message:Ne}=getValueAndMessage(E);if(isRegex(je)&&!q.match(je)&&(F[I]={type:INPUT_VALIDATION_RULES.pattern,message:Ne,ref:f,...ge(INPUT_VALIDATION_RULES.pattern,Ne)},!o))return Q(Ne),F}if(A){if(isFunction$2(A)){const je=await A(q,n),Ne=getValidateError(je,z);if(Ne&&(F[I]={...Ne,...ge(INPUT_VALIDATION_RULES.validate,Ne.message)},!o))return Q(Ne.message),F}else if(isObject(A)){let je={};for(const Ne in A){if(!isEmptyObject$1(je)&&!o)break;const Ae=getValidateError(await A[Ne](q,n),z,Ne);Ae&&(je={...Ae,...ge(Ne,Ae.message)},Q(Ae.message),o&&(F[I]=je))}if(!isEmptyObject$1(je)&&(F[I]={ref:z,...je},!o))return F}}return Q(!0),F};const defaultOptions={mode:VALIDATION_MODE.onSubmit,reValidateMode:VALIDATION_MODE.onChange,shouldFocusError:!0};function createFormControl(t={}){let e={...defaultOptions,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:isFunction$2(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=We=>nt=>{clearTimeout(_),_=setTimeout(We,nt)},I=async We=>{if(!e.disabled&&(S.isValid||R.isValid||We)){const nt=e.resolver?isEmptyObject$1((await te()).errors):await ae(o,!0);nt!==n.isValid&&C.state.next({isValid:nt})}},M=(We,nt)=>{!e.disabled&&(S.isValidating||S.validatingFields||R.isValidating||R.validatingFields)&&((We||Array.from(g.mount)).forEach(Qe=>{Qe&&(nt?set(n.validatingFields,Qe,nt):unset(n.validatingFields,Qe))}),C.state.next({validatingFields:n.validatingFields,isValidating:!isEmptyObject$1(n.validatingFields)}))},j=(We,nt=[],Qe,dt,pt=!0,ft=!0)=>{if(dt&&Qe&&!e.disabled){if(f.action=!0,ft&&Array.isArray(get(o,We))){const ct=Qe(get(o,We),dt.argA,dt.argB);pt&&set(o,We,ct)}if(ft&&Array.isArray(get(n.errors,We))){const ct=Qe(get(n.errors,We),dt.argA,dt.argB);pt&&set(n.errors,We,ct),unsetEmptyArray(n.errors,We)}if((S.touchedFields||R.touchedFields)&&ft&&Array.isArray(get(n.touchedFields,We))){const ct=Qe(get(n.touchedFields,We),dt.argA,dt.argB);pt&&set(n.touchedFields,We,ct)}(S.dirtyFields||R.dirtyFields)&&(n.dirtyFields=getDirtyFields(l,d)),C.state.next({name:We,isDirty:oe(We,nt),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else set(d,We,nt)},q=(We,nt)=>{set(n.errors,We,nt),C.state.next({errors:n.errors})},z=We=>{n.errors=We,C.state.next({errors:n.errors,isValid:!1})},Q=(We,nt,Qe,dt)=>{const pt=get(o,We);if(pt){const ft=get(d,We,isUndefined(Qe)?get(l,We):Qe);isUndefined(ft)||dt&&dt.defaultChecked||nt?set(d,We,nt?ft:getFieldValue(pt._f)):Ae(We,ft),f.mount&&I()}},F=(We,nt,Qe,dt,pt)=>{let ft=!1,ct=!1;const qt={name:We};if(!e.disabled){if(!Qe||dt){(S.isDirty||R.isDirty)&&(ct=n.isDirty,n.isDirty=qt.isDirty=oe(),ft=ct!==qt.isDirty);const ut=deepEqual$1(get(l,We),nt);ct=!!get(n.dirtyFields,We),ut?unset(n.dirtyFields,We):set(n.dirtyFields,We,!0),qt.dirtyFields=n.dirtyFields,ft=ft||(S.dirtyFields||R.dirtyFields)&&ct!==!ut}if(Qe){const ut=get(n.touchedFields,We);ut||(set(n.touchedFields,We,Qe),qt.touchedFields=n.touchedFields,ft=ft||(S.touchedFields||R.touchedFields)&&ut!==Qe)}ft&&pt&&C.state.next(qt)}return ft?qt:{}},O=(We,nt,Qe,dt)=>{const pt=get(n.errors,We),ft=(S.isValid||R.isValid)&&isBoolean(nt)&&n.isValid!==nt;if(e.delayError&&Qe?(b=A(()=>q(We,Qe)),b(e.delayError)):(clearTimeout(_),b=null,Qe?set(n.errors,We,Qe):unset(n.errors,We)),(Qe?!deepEqual$1(pt,Qe):pt)||!isEmptyObject$1(dt)||ft){const ct={...dt,...ft&&isBoolean(nt)?{isValid:nt}:{},errors:n.errors,name:We};n={...n,...ct},C.state.next(ct)}},te=async We=>{M(We,!0);const nt=await e.resolver(d,e.context,getResolverOptions(We||g.mount,o,e.criteriaMode,e.shouldUseNativeValidation));return M(We),nt},ne=async We=>{const{errors:nt}=await te(We);if(We)for(const Qe of We){const dt=get(nt,Qe);dt?set(n.errors,Qe,dt):unset(n.errors,Qe)}else n.errors=nt;return nt},ae=async(We,nt,Qe={valid:!0})=>{for(const dt in We){const pt=We[dt];if(pt){const{_f:ft,...ct}=pt;if(ft){const qt=g.array.has(ft.name),ut=pt._f&&hasPromiseValidation(pt._f);ut&&S.validatingFields&&M([dt],!0);const Mt=await validateField(pt,g.disabled,d,E,e.shouldUseNativeValidation&&!nt,qt);if(ut&&S.validatingFields&&M([dt]),Mt[ft.name]&&(Qe.valid=!1,nt))break;!nt&&(get(Mt,ft.name)?qt?updateFieldArrayRootError(n.errors,Mt,ft.name):set(n.errors,ft.name,Mt[ft.name]):unset(n.errors,ft.name))}!isEmptyObject$1(ct)&&await ae(ct,nt,Qe)}}return Qe.valid},ge=()=>{for(const We of g.unMount){const nt=get(o,We);nt&&(nt._f.refs?nt._f.refs.every(Qe=>!live(Qe)):!live(nt._f.ref))&&Ze(We)}g.unMount=new Set},oe=(We,nt)=>!e.disabled&&(We&&nt&&set(d,We,nt),!deepEqual$1(qe(),l)),je=(We,nt,Qe)=>generateWatchOutput(We,g,{...f.mount?d:isUndefined(nt)?l:isString(We)?{[We]:nt}:nt},Qe,nt),Ne=We=>compact(get(f.mount?d:l,We,e.shouldUnregister?get(l,We,[]):[])),Ae=(We,nt,Qe={})=>{const dt=get(o,We);let pt=nt;if(dt){const ft=dt._f;ft&&(!ft.disabled&&set(d,We,getFieldValueAs(nt,ft)),pt=isHTMLElement(ft.ref)&&isNullOrUndefined(nt)?"":nt,isMultipleSelect(ft.ref)?[...ft.ref.options].forEach(ct=>ct.selected=pt.includes(ct.value)):ft.refs?isCheckBoxInput(ft.ref)?ft.refs.forEach(ct=>{(!ct.defaultChecked||!ct.disabled)&&(Array.isArray(pt)?ct.checked=!!pt.find(qt=>qt===ct.value):ct.checked=pt===ct.value||!!pt)}):ft.refs.forEach(ct=>ct.checked=ct.value===pt):isFileInput(ft.ref)?ft.ref.value="":(ft.ref.value=pt,ft.ref.type||C.state.next({name:We,values:cloneObject(d)})))}(Qe.shouldDirty||Qe.shouldTouch)&&F(We,pt,Qe.shouldTouch,Qe.shouldDirty,!0),Qe.shouldValidate&&Be(We)},$e=(We,nt,Qe)=>{for(const dt in nt){if(!nt.hasOwnProperty(dt))return;const pt=nt[dt],ft=We+"."+dt,ct=get(o,ft);(g.array.has(We)||isObject(pt)||ct&&!ct._f)&&!isDateObject(pt)?$e(ft,pt,Qe):Ae(ft,pt,Qe)}},Fe=(We,nt,Qe={})=>{const dt=get(o,We),pt=g.array.has(We),ft=cloneObject(nt);set(d,We,ft),pt?(C.array.next({name:We,values:cloneObject(d)}),(S.isDirty||S.dirtyFields||R.isDirty||R.dirtyFields)&&Qe.shouldDirty&&C.state.next({name:We,dirtyFields:getDirtyFields(l,d),isDirty:oe(We,ft)})):dt&&!dt._f&&!isNullOrUndefined(ft)?$e(We,ft,Qe):Ae(We,ft,Qe),isWatched(We,g)&&C.state.next({...n}),C.state.next({name:f.mount?We:void 0,values:cloneObject(d)})},ze=async We=>{f.mount=!0;const nt=We.target;let Qe=nt.name,dt=!0;const pt=get(o,Qe),ft=ut=>{dt=Number.isNaN(ut)||isDateObject(ut)&&isNaN(ut.getTime())||deepEqual$1(ut,get(d,Qe,ut))},ct=getValidationModes(e.mode),qt=getValidationModes(e.reValidateMode);if(pt){let ut,Mt;const Ut=nt.type?getFieldValue(pt._f):getEventValue(We),yt=We.type===EVENTS.BLUR||We.type===EVENTS.FOCUS_OUT,nr=!hasValidation(pt._f)&&!e.resolver&&!get(n.errors,Qe)&&!pt._f.deps||skipValidation(yt,get(n.touchedFields,Qe),n.isSubmitted,qt,ct),er=isWatched(Qe,g,yt);set(d,Qe,Ut),yt?(pt._f.onBlur&&pt._f.onBlur(We),b&&b(0)):pt._f.onChange&&pt._f.onChange(We);const lr=F(Qe,Ut,yt),cr=!isEmptyObject$1(lr)||er;if(!yt&&C.state.next({name:Qe,type:We.type,values:cloneObject(d)}),nr)return(S.isValid||R.isValid)&&(e.mode==="onBlur"?yt&&I():yt||I()),cr&&C.state.next({name:Qe,...er?{}:lr});if(!yt&&er&&C.state.next({...n}),e.resolver){const{errors:vr}=await te([Qe]);if(ft(Ut),dt){const Ir=schemaErrorLookup(n.errors,o,Qe),Nr=schemaErrorLookup(vr,o,Ir.name||Qe);ut=Nr.error,Qe=Nr.name,Mt=isEmptyObject$1(vr)}}else M([Qe],!0),ut=(await validateField(pt,g.disabled,d,E,e.shouldUseNativeValidation))[Qe],M([Qe]),ft(Ut),dt&&(ut?Mt=!1:(S.isValid||R.isValid)&&(Mt=await ae(o,!0)));dt&&(pt._f.deps&&Be(pt._f.deps),O(Qe,Mt,ut,lr))}},Ve=(We,nt)=>{if(get(n.errors,nt)&&We.focus)return We.focus(),1},Be=async(We,nt={})=>{let Qe,dt;const pt=convertToArrayPayload(We);if(e.resolver){const ft=await ne(isUndefined(We)?We:pt);Qe=isEmptyObject$1(ft),dt=We?!pt.some(ct=>get(ft,ct)):Qe}else We?(dt=(await Promise.all(pt.map(async ft=>{const ct=get(o,ft);return await ae(ct&&ct._f?{[ft]:ct}:ct)}))).every(Boolean),!(!dt&&!n.isValid)&&I()):dt=Qe=await ae(o);return C.state.next({...!isString(We)||(S.isValid||R.isValid)&&Qe!==n.isValid?{}:{name:We},...e.resolver||!We?{isValid:Qe}:{},errors:n.errors}),nt.shouldFocus&&!dt&&iterateFieldsByAction(o,Ve,We?pt:g.mount),dt},qe=We=>{const nt={...f.mount?d:l};return isUndefined(We)?nt:isString(We)?get(nt,We):We.map(Qe=>get(nt,Qe))},Ke=(We,nt)=>({invalid:!!get((nt||n).errors,We),isDirty:!!get((nt||n).dirtyFields,We),error:get((nt||n).errors,We),isValidating:!!get(n.validatingFields,We),isTouched:!!get((nt||n).touchedFields,We)}),He=We=>{We&&convertToArrayPayload(We).forEach(nt=>unset(n.errors,nt)),C.state.next({errors:We?n.errors:{}})},Xe=(We,nt,Qe)=>{const dt=(get(o,We,{_f:{}})._f||{}).ref,pt=get(n.errors,We)||{},{ref:ft,message:ct,type:qt,...ut}=pt;set(n.errors,We,{...ut,...nt,ref:dt}),C.state.next({name:We,errors:n.errors,isValid:!1}),Qe&&Qe.shouldFocus&&dt&&dt.focus&&dt.focus()},tt=(We,nt)=>isFunction$2(We)?C.state.subscribe({next:Qe=>We(je(void 0,nt),Qe)}):je(We,nt,!0),Ye=We=>C.state.subscribe({next:nt=>{shouldSubscribeByName(We.name,nt.name,We.exact)&&shouldRenderFormState(nt,We.formState||S,Dt,We.reRenderRoot)&&We.callback({values:{...d},...n,...nt})}}).unsubscribe,et=We=>(f.mount=!0,R={...R,...We.formState},Ye({...We,formState:R})),Ze=(We,nt={})=>{for(const Qe of We?convertToArrayPayload(We):g.mount)g.mount.delete(Qe),g.array.delete(Qe),nt.keepValue||(unset(o,Qe),unset(d,Qe)),!nt.keepError&&unset(n.errors,Qe),!nt.keepDirty&&unset(n.dirtyFields,Qe),!nt.keepTouched&&unset(n.touchedFields,Qe),!nt.keepIsValidating&&unset(n.validatingFields,Qe),!e.shouldUnregister&&!nt.keepDefaultValue&&unset(l,Qe);C.state.next({values:cloneObject(d)}),C.state.next({...n,...nt.keepDirty?{isDirty:oe()}:{}}),!nt.keepIsValid&&I()},at=({disabled:We,name:nt})=>{(isBoolean(We)&&f.mount||We||g.disabled.has(nt))&&(We?g.disabled.add(nt):g.disabled.delete(nt))},rt=(We,nt={})=>{let Qe=get(o,We);const dt=isBoolean(nt.disabled)||isBoolean(e.disabled);return set(o,We,{...Qe||{},_f:{...Qe&&Qe._f?Qe._f:{ref:{name:We}},name:We,mount:!0,...nt}}),g.mount.add(We),Qe?at({disabled:isBoolean(nt.disabled)?nt.disabled:e.disabled,name:We}):Q(We,!0,nt.value),{...dt?{disabled:nt.disabled||e.disabled}:{},...e.progressive?{required:!!nt.required,min:getRuleValue(nt.min),max:getRuleValue(nt.max),minLength:getRuleValue(nt.minLength),maxLength:getRuleValue(nt.maxLength),pattern:getRuleValue(nt.pattern)}:{},name:We,onChange:ze,onBlur:ze,ref:pt=>{if(pt){rt(We,nt),Qe=get(o,We);const ft=isUndefined(pt.value)&&pt.querySelectorAll&&pt.querySelectorAll("input,select,textarea")[0]||pt,ct=isRadioOrCheckbox(ft),qt=Qe._f.refs||[];if(ct?qt.find(ut=>ut===ft):ft===Qe._f.ref)return;set(o,We,{_f:{...Qe._f,...ct?{refs:[...qt.filter(live),ft,...Array.isArray(get(l,We))?[{}]:[]],ref:{type:ft.type,name:We}}:{ref:ft}}}),Q(We,!1,void 0,ft)}else Qe=get(o,We,{}),Qe._f&&(Qe._f.mount=!1),(e.shouldUnregister||nt.shouldUnregister)&&!(isNameInFieldArray(g.array,We)&&f.action)&&g.unMount.add(We)}}},it=()=>e.shouldFocusError&&iterateFieldsByAction(o,Ve,g.mount),st=We=>{isBoolean(We)&&(C.state.next({disabled:We}),iterateFieldsByAction(o,(nt,Qe)=>{const dt=get(o,Qe);dt&&(nt.disabled=dt._f.disabled||We,Array.isArray(dt._f.refs)&&dt._f.refs.forEach(pt=>{pt.disabled=dt._f.disabled||We}))},0,!1))},Ue=(We,nt)=>async Qe=>{let dt;Qe&&(Qe.preventDefault&&Qe.preventDefault(),Qe.persist&&Qe.persist());let pt=cloneObject(d);if(C.state.next({isSubmitting:!0}),e.resolver){const{errors:ft,values:ct}=await te();n.errors=ft,pt=ct}else await ae(o);if(g.disabled.size)for(const ft of g.disabled)set(pt,ft,void 0);if(unset(n.errors,"root"),isEmptyObject$1(n.errors)){C.state.next({errors:{}});try{await We(pt,Qe)}catch(ft){dt=ft}}else nt&&await nt({...n.errors},Qe),it(),setTimeout(it);if(C.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:isEmptyObject$1(n.errors)&&!dt,submitCount:n.submitCount+1,errors:n.errors}),dt)throw dt},Rt=(We,nt={})=>{get(o,We)&&(isUndefined(nt.defaultValue)?Fe(We,cloneObject(get(l,We))):(Fe(We,nt.defaultValue),set(l,We,cloneObject(nt.defaultValue))),nt.keepTouched||unset(n.touchedFields,We),nt.keepDirty||(unset(n.dirtyFields,We),n.isDirty=nt.defaultValue?oe(We,cloneObject(get(l,We))):oe()),nt.keepError||(unset(n.errors,We),S.isValid&&I()),C.state.next({...n}))},Je=(We,nt={})=>{const Qe=We?cloneObject(We):l,dt=cloneObject(Qe),pt=isEmptyObject$1(We),ft=pt?l:dt;if(nt.keepDefaultValues||(l=Qe),!nt.keepValues){if(nt.keepDirtyValues){const ct=new Set([...g.mount,...Object.keys(getDirtyFields(l,d))]);for(const qt of Array.from(ct))get(n.dirtyFields,qt)?set(ft,qt,get(d,qt)):Fe(qt,get(ft,qt))}else{if(isWeb&&isUndefined(We))for(const ct of g.mount){const qt=get(o,ct);if(qt&&qt._f){const ut=Array.isArray(qt._f.refs)?qt._f.refs[0]:qt._f.ref;if(isHTMLElement(ut)){const Mt=ut.closest("form");if(Mt){Mt.reset();break}}}}for(const ct of g.mount)Fe(ct,get(ft,ct))}d=cloneObject(ft),C.array.next({values:{...ft}}),C.state.next({values:{...ft}})}g={mount:nt.keepDirtyValues?g.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},f.mount=!S.isValid||!!nt.keepIsValid||!!nt.keepDirtyValues,f.watch=!!e.shouldUnregister,C.state.next({submitCount:nt.keepSubmitCount?n.submitCount:0,isDirty:pt?!1:nt.keepDirty?n.isDirty:!!(nt.keepDefaultValues&&!deepEqual$1(We,l)),isSubmitted:nt.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:pt?{}:nt.keepDirtyValues?nt.keepDefaultValues&&d?getDirtyFields(l,d):n.dirtyFields:nt.keepDefaultValues&&We?getDirtyFields(l,We):nt.keepDirty?n.dirtyFields:{},touchedFields:nt.keepTouched?n.touchedFields:{},errors:nt.keepErrors?n.errors:{},isSubmitSuccessful:nt.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},mt=(We,nt)=>Je(isFunction$2(We)?We(d):We,nt),$t=(We,nt={})=>{const Qe=get(o,We),dt=Qe&&Qe._f;if(dt){const pt=dt.refs?dt.refs[0]:dt.ref;pt.focus&&(pt.focus(),nt.shouldSelect&&isFunction$2(pt.select)&&pt.select())}},Dt=We=>{n={...n,...We}},Vt={control:{register:rt,unregister:Ze,getFieldState:Ke,handleSubmit:Ue,setError:Xe,_subscribe:Ye,_runSchema:te,_focusError:it,_getWatch:je,_getDirty:oe,_setValid:I,_setFieldArray:j,_setDisabledField:at,_setErrors:z,_getFieldArray:Ne,_reset:Je,_resetDefaultValues:()=>isFunction$2(e.defaultValues)&&e.defaultValues().then(We=>{mt(We,e.resetOptions),C.state.next({isLoading:!1})}),_removeUnmounted:ge,_disableForm:st,_subjects:C,_proxyFormState:S,get _fields(){return o},get _formValues(){return d},get _state(){return f},set _state(We){f=We},get _defaultValues(){return l},get _names(){return g},set _names(We){g=We},get _formState(){return n},get _options(){return e},set _options(We){e={...e,...We}}},subscribe:et,trigger:Be,register:rt,handleSubmit:Ue,watch:tt,setValue:Fe,getValues:qe,reset:mt,resetField:Rt,clearErrors:He,unregister:Ze,setError:Xe,setFocus:$t,getFieldState:Ke};return{...Vt,formControl:Vt}}function useForm(t={}){const e=React.useRef(void 0),n=React.useRef(void 0),[o,l]=React.useState({isDirty:!1,isValidating:!1,isLoading:isFunction$2(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$2(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...t.formControl?t.formControl:createFormControl(t),formState:o},t.formControl&&t.defaultValues&&!isFunction$2(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}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:I}}=useForm({defaultValues:_}),M=E(),j=React.useCallback(()=>g?JSON.stringify(M)!==JSON.stringify(g):!1,[M,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,O=!1;const te=Object.keys(Q).map(ne=>({key:ne,keyApi:ne.charAt(0).toUpperCase()+ne.slice(1)}));for(const ne of te){const ae=Q[ne.key],ge=t[ne.keyApi];if(ae!==ge&&ae!==void 0){O=!0;try{await f({applicationId:e,fieldName:ne.keyApi,newValue:String(ae)}).unwrap()||(F=!1)}catch(oe){console.error(`Error updating ${ne.keyApi}:`,oe),F=!1}}}F&&O?(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:I||o,className:o?"hidden":"",children:I?"Saving...":"Save"})})]})]})]})};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
1086
+ `);A(!0),$e({routeApplicationId:t,partnerId:e.ManufacturerId??"",message:it}).then(st=>{var Rt;if(st.error){console.error(st.error),n({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"});return}const Ue=(Rt=st.data)==null?void 0:Rt.ConversationId;Ue&&Fe(Ue)?(f(!1),Ve()):n({title:"Could not send message",description:"Try again later.",variant:"destructive"})}).catch(st=>{console.error(st),n({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"})}).finally(()=>{A(!1)})},He=(et,Ze)=>{Q(at=>Ze?[...at,et]:at.filter(rt=>rt!==et)),O("")},Xe=(et,Ze)=>{ge(at=>Ze?[...at,et]:at.filter(rt=>rt!==et)),je("")},tt=z.includes("other-channel"),Ye=ae.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:et=>{l(et)},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:et=>{S(et.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:et=>{f(et)},children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[768px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsx(DialogTitle,{children:"Introduce Yourself"})}),jsxRuntime.jsxs("form",{onSubmit:Ke,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:I,onChange:et=>{M(et.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(et=>jsxRuntime.jsxs("div",{className:"flex items-start space-x-2",children:[jsxRuntime.jsx(Checkbox,{id:`channel-${et.id}`,checked:z.includes(et.id),onCheckedChange:Ze=>He(et.id,Ze===!0)}),jsxRuntime.jsx(Label$2,{htmlFor:`channel-${et.id}`,className:"text-sm font-normal",children:et.label})]},et.id))}),tt&&jsxRuntime.jsx(Input,{placeholder:"Please specify",value:te,onChange:et=>ne(et.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(et=>jsxRuntime.jsxs("div",{className:"flex items-start space-x-2",children:[jsxRuntime.jsx(Checkbox,{id:`market-${et.id}`,checked:ae.includes(et.id),onCheckedChange:Ze=>Xe(et.id,Ze===!0)}),jsxRuntime.jsx(Label$2,{htmlFor:`market-${et.id}`,className:"text-sm font-normal",children:et.label})]},et.id))}),Ye&&jsxRuntime.jsx(Input,{placeholder:"Please specify",value:Ne,onChange:et=>Ae(et.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,I=usePopperScope$1(e),[M,j]=React__namespace.useState(null),[q,z]=React__namespace.useState(null),[Q,F]=React__namespace.useState(!1),O=useDirection(_),[te,ne]=useControllableState({prop:o,defaultProp:l??!1,onChange:d,caller:SELECT_NAME}),[ae,ge]=useControllableState({prop:f,defaultProp:g,onChange:b,caller:SELECT_NAME}),oe=React__namespace.useRef(null),je=M?A||!!M.closest("form"):!0,[Ne,Ae]=React__namespace.useState(new Set),$e=Array.from(Ne).map(Fe=>Fe.props.value).join(";");return jsxRuntime.jsx(Root2$6,{...I,children:jsxRuntime.jsxs(SelectProvider,{required:E,scope:e,trigger:M,onTriggerChange:j,valueNode:q,onValueNodeChange:z,valueNodeHasChildren:Q,onValueNodeHasChildrenChange:F,contentId:useId(),value:ae,onValueChange:ge,open:te,onOpenChange:ne,dir:O,triggerPointerDownPosRef:oe,disabled:C,children:[jsxRuntime.jsx(Collection.Provider,{scope:e,children:jsxRuntime.jsx(SelectNativeOptionsProvider,{scope:t.__scopeSelect,onNativeOptionAdd:React__namespace.useCallback(Fe=>{Ae(ze=>new Set(ze).add(Fe))},[]),onNativeOptionRemove:React__namespace.useCallback(Fe=>{Ae(ze=>{const Ve=new Set(ze);return Ve.delete(Fe),Ve})},[]),children:n})}),je?jsxRuntime.jsxs(SelectBubbleInput,{"aria-hidden":!0,required:E,tabIndex:-1,name:S,autoComplete:R,value:ae,onChange:Fe=>ge(Fe.target.value),disabled:C,form:A,children:[ae===void 0?jsxRuntime.jsx("option",{value:""}):null,Array.from(Ne)]},$e):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(I=>{const M=_().filter(z=>!z.disabled),j=M.find(z=>z.value===f.value),q=findNextItem(M,I,j);q!==void 0&&f.onValueChange(q.value)}),A=I=>{g||(f.onOpenChange(!0),E()),I&&(f.triggerPointerDownPosRef.current={x:Math.round(I.pageX),y:Math.round(I.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,I=>{I.currentTarget.focus(),S.current!=="mouse"&&A(I)}),onPointerDown:composeEventHandlers(l.onPointerDown,I=>{S.current=I.pointerType;const M=I.target;M.hasPointerCapture(I.pointerId)&&M.releasePointerCapture(I.pointerId),I.button===0&&I.ctrlKey===!1&&I.pointerType==="mouse"&&(A(I),I.preventDefault())}),onKeyDown:composeEventHandlers(l.onKeyDown,I=>{const M=R.current!=="";!(I.ctrlKey||I.altKey||I.metaKey)&&I.key.length===1&&C(I.key),!(M&&I.key===" ")&&OPEN_KEYS.includes(I.key)&&(A(),I.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:I,avoidCollisions:M,...j}=t,q=useSelectContext(CONTENT_NAME$2,n),[z,Q]=React__namespace.useState(null),[F,O]=React__namespace.useState(null),te=useComposedRefs(e,Ze=>Q(Ze)),[ne,ae]=React__namespace.useState(null),[ge,oe]=React__namespace.useState(null),je=useCollection(n),[Ne,Ae]=React__namespace.useState(!1),$e=React__namespace.useRef(!1);React__namespace.useEffect(()=>{if(z)return hideOthers(z)},[z]),useFocusGuards();const Fe=React__namespace.useCallback(Ze=>{const[at,...rt]=je().map(Ue=>Ue.ref.current),[it]=rt.slice(-1),st=document.activeElement;for(const Ue of Ze)if(Ue===st||(Ue==null||Ue.scrollIntoView({block:"nearest"}),Ue===at&&F&&(F.scrollTop=0),Ue===it&&F&&(F.scrollTop=F.scrollHeight),Ue==null||Ue.focus(),document.activeElement!==st))return},[je,F]),ze=React__namespace.useCallback(()=>Fe([ne,z]),[Fe,ne,z]);React__namespace.useEffect(()=>{Ne&&ze()},[Ne,ze]);const{onOpenChange:Ve,triggerPointerDownPosRef:Be}=q;React__namespace.useEffect(()=>{if(z){let Ze={x:0,y:0};const at=it=>{var st,Ue;Ze={x:Math.abs(Math.round(it.pageX)-(((st=Be.current)==null?void 0:st.x)??0)),y:Math.abs(Math.round(it.pageY)-(((Ue=Be.current)==null?void 0:Ue.y)??0))}},rt=it=>{Ze.x<=10&&Ze.y<=10?it.preventDefault():z.contains(it.target)||Ve(!1),document.removeEventListener("pointermove",at),Be.current=null};return Be.current!==null&&(document.addEventListener("pointermove",at),document.addEventListener("pointerup",rt,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",at),document.removeEventListener("pointerup",rt,{capture:!0})}}},[z,Ve,Be]),React__namespace.useEffect(()=>{const Ze=()=>Ve(!1);return window.addEventListener("blur",Ze),window.addEventListener("resize",Ze),()=>{window.removeEventListener("blur",Ze),window.removeEventListener("resize",Ze)}},[Ve]);const[qe,Ke]=useTypeaheadSearch(Ze=>{const at=je().filter(st=>!st.disabled),rt=at.find(st=>st.ref.current===document.activeElement),it=findNextItem(at,Ze,rt);it&&setTimeout(()=>it.ref.current.focus())}),He=React__namespace.useCallback((Ze,at,rt)=>{const it=!$e.current&&!rt;(q.value!==void 0&&q.value===at||it)&&(ae(Ze),it&&($e.current=!0))},[q.value]),Xe=React__namespace.useCallback(()=>z==null?void 0:z.focus(),[z]),tt=React__namespace.useCallback((Ze,at,rt)=>{const it=!$e.current&&!rt;(q.value!==void 0&&q.value===at||it)&&oe(Ze)},[q.value]),Ye=o==="popper"?SelectPopperPosition:SelectItemAlignedPosition,et=Ye===SelectPopperPosition?{side:g,sideOffset:b,align:_,alignOffset:S,arrowPadding:R,collisionBoundary:C,collisionPadding:E,sticky:A,hideWhenDetached:I,avoidCollisions:M}:{};return jsxRuntime.jsx(SelectContentProvider,{scope:n,content:z,viewport:F,onViewportChange:O,itemRefCallback:He,selectedItem:ne,onItemLeave:Xe,itemTextRefCallback:tt,focusSelectedItem:ze,selectedItemText:ge,position:o,isPositioned:Ne,searchRef:qe,children:jsxRuntime.jsx(ReactRemoveScroll,{as:Slot$1,allowPinchZoom:!0,children:jsxRuntime.jsx(FocusScope,{asChild:!0,trapped:q.open,onMountAutoFocus:Ze=>{Ze.preventDefault()},onUnmountAutoFocus:composeEventHandlers(l,Ze=>{var at;(at=q.trigger)==null||at.focus({preventScroll:!0}),Ze.preventDefault()}),children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:Ze=>Ze.preventDefault(),onDismiss:()=>q.onOpenChange(!1),children:jsxRuntime.jsx(Ye,{role:"listbox",id:q.contentId,"data-state":q.open?"open":"closed",dir:q.dir,onContextMenu:Ze=>Ze.preventDefault(),...j,...et,onPlaced:()=>Ae(!0),ref:te,style:{display:"flex",flexDirection:"column",outline:"none",...j.style},onKeyDown:composeEventHandlers(j.onKeyDown,Ze=>{const at=Ze.ctrlKey||Ze.altKey||Ze.metaKey;if(Ze.key==="Tab"&&Ze.preventDefault(),!at&&Ze.key.length===1&&Ke(Ze.key),["ArrowUp","ArrowDown","Home","End"].includes(Ze.key)){let it=je().filter(st=>!st.disabled).map(st=>st.ref.current);if(["ArrowUp","End"].includes(Ze.key)&&(it=it.slice().reverse()),["ArrowUp","ArrowDown"].includes(Ze.key)){const st=Ze.target,Ue=it.indexOf(st);it=it.slice(Ue+1)}setTimeout(()=>Fe(it)),Ze.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:I,selectedItem:M,selectedItemText:j,focusSelectedItem:q}=f,z=React__namespace.useCallback(()=>{if(d.trigger&&d.valueNode&&g&&_&&I&&M&&j){const te=d.trigger.getBoundingClientRect(),ne=_.getBoundingClientRect(),ae=d.valueNode.getBoundingClientRect(),ge=j.getBoundingClientRect();if(d.dir!=="rtl"){const st=ge.left-ne.left,Ue=ae.left-st,Rt=te.left-Ue,Je=te.width+Rt,mt=Math.max(Je,ne.width),$t=window.innerWidth-CONTENT_MARGIN,Dt=clamp(Ue,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,$t-mt)]);g.style.minWidth=Je+"px",g.style.left=Dt+"px"}else{const st=ne.right-ge.right,Ue=window.innerWidth-ae.right-st,Rt=window.innerWidth-te.right-Ue,Je=te.width+Rt,mt=Math.max(Je,ne.width),$t=window.innerWidth-CONTENT_MARGIN,Dt=clamp(Ue,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,$t-mt)]);g.style.minWidth=Je+"px",g.style.right=Dt+"px"}const oe=C(),je=window.innerHeight-CONTENT_MARGIN*2,Ne=I.scrollHeight,Ae=window.getComputedStyle(_),$e=parseInt(Ae.borderTopWidth,10),Fe=parseInt(Ae.paddingTop,10),ze=parseInt(Ae.borderBottomWidth,10),Ve=parseInt(Ae.paddingBottom,10),Be=$e+Fe+Ne+Ve+ze,qe=Math.min(M.offsetHeight*5,Be),Ke=window.getComputedStyle(I),He=parseInt(Ke.paddingTop,10),Xe=parseInt(Ke.paddingBottom,10),tt=te.top+te.height/2-CONTENT_MARGIN,Ye=je-tt,et=M.offsetHeight/2,Ze=M.offsetTop+et,at=$e+Fe+Ze,rt=Be-at;if(at<=tt){const st=oe.length>0&&M===oe[oe.length-1].ref.current;g.style.bottom="0px";const Ue=_.clientHeight-I.offsetTop-I.offsetHeight,Rt=Math.max(Ye,et+(st?Xe:0)+Ue+ze),Je=at+Rt;g.style.height=Je+"px"}else{const st=oe.length>0&&M===oe[0].ref.current;g.style.top="0px";const Rt=Math.max(tt,$e+I.offsetTop+(st?He:0)+et)+rt;g.style.height=Rt+"px",I.scrollTop=at-tt+I.offsetTop}g.style.margin=`${CONTENT_MARGIN}px 0`,g.style.minHeight=qe+"px",g.style.maxHeight=je+"px",o==null||o(),requestAnimationFrame(()=>E.current=!0)}},[C,d.trigger,d.valueNode,g,_,I,M,j,d.dir,o]);useLayoutEffect2(()=>z(),[z]);const[Q,F]=React__namespace.useState();useLayoutEffect2(()=>{_&&F(window.getComputedStyle(_).zIndex)},[_]);const O=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:O,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,I=parseFloat(R.style.minHeight),M=parseFloat(R.style.height),j=Math.max(I,M);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)}),I=useId(),M=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:I,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":I,"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,()=>{M.current!=="mouse"&&j()}),onPointerUp:composeEventHandlers(f.onPointerUp,()=>{M.current==="mouse"&&j()}),onPointerDown:composeEventHandlers(f.onPointerDown,q=>{M.current=q.pointerType}),onPointerMove:composeEventHandlers(f.onPointerMove,q=>{var z;M.current=q.pointerType,l?(z=b.onItemLeave)==null||z.call(b):M.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:I,onNativeOptionRemove:M}=_;return useLayoutEffect2(()=>(I(A),()=>M(A)),[I,M,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],I=j=>j==="ASAP"?-1:DAYS_OF_WEEK.indexOf(j),M=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",I(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||!M,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=M=>{n(e.filter(j=>j!==M))},A=M=>{f(!1),e.includes(M)?n(e.filter(j=>j!==M)):n([...e,M])},I=M=>{M.key==="Enter"&&g&&!t.includes(g)&&!e.includes(g)&&(M.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(M=>jsxRuntime.jsxs(Badge,{variant:"outline",className:"mr-1 mb-1",children:[M,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(M)},children:jsxRuntime.jsx(X$1,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},M)):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:I,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(M=>!e.includes(M)).map(M=>jsxRuntime.jsxs(CommandItem,{onSelect:()=>A(M),children:[jsxRuntime.jsx(Check,{className:cn("mr-2 h-4 w-4",e.includes(M)?"opacity-100":"opacity-0")}),M]},M)),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`,I=React.useRef(null),M=useIntersectionObserver({elementRef:I,threshold:.1,rootMargin:"100px"});React__namespace.useEffect(()=>{const F=async()=>{try{const te=await(await fetch(A+"/Exists")).json();g(te)}catch(O){console.error("Error checking for video:",O),g(!1)}};M&&!b&&(_(!0),F())},[t,A,M,b]);async function j(){if(f){E(!0);try{const O=await(await fetch(A)).blob(),te=window.URL.createObjectURL(O),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:I,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"}],o=React.useMemo(()=>{const l=new Map;return e.forEach(d=>{var g;const f=((g=d.Day)==null?void 0:g.toString())||"";if(f.length===8){const b=parseInt(f.substring(0,4),10),_=parseInt(f.substring(4,6),10)-1,S=parseInt(f.substring(6,8),10),R=new Date(b,_,S),C=new Date(R),E=R.getDay();C.setDate(R.getDate()-E);const A=`${C.getFullYear()}-${String(C.getMonth()+1).padStart(2,"0")}-${String(C.getDate()).padStart(2,"0")}`,I=d.ExtendedPrice||0;l.has(A)?l.set(A,l.get(A)+I):l.set(A,I)}}),Array.from(l).sort(([d],[f])=>d.localeCompare(f)).map(([d,f])=>({date:`${d.substring(5,7)}/${d.substring(8,10)}`,amount:f}))},[e]);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((l,d)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"text-sm @sm:text-base font-medium",children:l.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${l.color}`,children:l.icon})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base @sm:text-lg font-bold",children:formatMoney(l.amount)})]})]},d))}),jsxRuntime.jsx("div",{className:"mt-6",children:e&&e.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("h3",{className:"text-sm font-medium mb-4",children:"Sales Trend"}),jsxRuntime.jsx("div",{className:"space-y-6",children:jsxRuntime.jsx(AreaChart,{data:o,units:"$",unitsPosition:"left",height:200})})]})})]})]})}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$2=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$2(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$2(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:I,valueAsNumber:M,mount:j}=t._f,q=get(n,I);if(!j||e.has(I))return{};const z=g?g[0]:f,Q=je=>{l&&z.reportValidity&&(z.setCustomValidity(isBoolean(je)?"":je||""),z.reportValidity())},F={},O=isRadioInput(f),te=isCheckBoxInput(f),ne=O||te,ae=(M||isFileInput(f))&&isUndefined(f.value)&&isUndefined(q)||isHTMLElement(f)&&f.value===""||q===""||Array.isArray(q)&&!q.length,ge=appendErrors.bind(null,I,o,F),oe=(je,Ne,Ae,$e=INPUT_VALIDATION_RULES.maxLength,Fe=INPUT_VALIDATION_RULES.minLength)=>{const ze=je?Ne:Ae;F[I]={type:je?$e:Fe,message:ze,ref:f,...ge(je?$e:Fe,ze)}};if(d?!Array.isArray(q)||!q.length:b&&(!ne&&(ae||isNullOrUndefined(q))||isBoolean(q)&&!q||te&&!getCheckboxValue(g).isValid||O&&!getRadioValue(g).isValid)){const{value:je,message:Ne}=isMessage(b)?{value:!!b,message:b}:getValueAndMessage(b);if(je&&(F[I]={type:INPUT_VALIDATION_RULES.required,message:Ne,ref:z,...ge(INPUT_VALIDATION_RULES.required,Ne)},!o))return Q(Ne),F}if(!ae&&(!isNullOrUndefined(R)||!isNullOrUndefined(C))){let je,Ne;const Ae=getValueAndMessage(C),$e=getValueAndMessage(R);if(!isNullOrUndefined(q)&&!isNaN(q)){const Fe=f.valueAsNumber||q&&+q;isNullOrUndefined(Ae.value)||(je=Fe>Ae.value),isNullOrUndefined($e.value)||(Ne=Fe<$e.value)}else{const Fe=f.valueAsDate||new Date(q),ze=qe=>new Date(new Date().toDateString()+" "+qe),Ve=f.type=="time",Be=f.type=="week";isString(Ae.value)&&q&&(je=Ve?ze(q)>ze(Ae.value):Be?q>Ae.value:Fe>new Date(Ae.value)),isString($e.value)&&q&&(Ne=Ve?ze(q)<ze($e.value):Be?q<$e.value:Fe<new Date($e.value))}if((je||Ne)&&(oe(!!je,Ae.message,$e.message,INPUT_VALIDATION_RULES.max,INPUT_VALIDATION_RULES.min),!o))return Q(F[I].message),F}if((_||S)&&!ae&&(isString(q)||d&&Array.isArray(q))){const je=getValueAndMessage(_),Ne=getValueAndMessage(S),Ae=!isNullOrUndefined(je.value)&&q.length>+je.value,$e=!isNullOrUndefined(Ne.value)&&q.length<+Ne.value;if((Ae||$e)&&(oe(Ae,je.message,Ne.message),!o))return Q(F[I].message),F}if(E&&!ae&&isString(q)){const{value:je,message:Ne}=getValueAndMessage(E);if(isRegex(je)&&!q.match(je)&&(F[I]={type:INPUT_VALIDATION_RULES.pattern,message:Ne,ref:f,...ge(INPUT_VALIDATION_RULES.pattern,Ne)},!o))return Q(Ne),F}if(A){if(isFunction$2(A)){const je=await A(q,n),Ne=getValidateError(je,z);if(Ne&&(F[I]={...Ne,...ge(INPUT_VALIDATION_RULES.validate,Ne.message)},!o))return Q(Ne.message),F}else if(isObject(A)){let je={};for(const Ne in A){if(!isEmptyObject$1(je)&&!o)break;const Ae=getValidateError(await A[Ne](q,n),z,Ne);Ae&&(je={...Ae,...ge(Ne,Ae.message)},Q(Ae.message),o&&(F[I]=je))}if(!isEmptyObject$1(je)&&(F[I]={ref:z,...je},!o))return F}}return Q(!0),F};const defaultOptions={mode:VALIDATION_MODE.onSubmit,reValidateMode:VALIDATION_MODE.onChange,shouldFocusError:!0};function createFormControl(t={}){let e={...defaultOptions,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:isFunction$2(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=We=>nt=>{clearTimeout(_),_=setTimeout(We,nt)},I=async We=>{if(!e.disabled&&(S.isValid||R.isValid||We)){const nt=e.resolver?isEmptyObject$1((await te()).errors):await ae(o,!0);nt!==n.isValid&&C.state.next({isValid:nt})}},M=(We,nt)=>{!e.disabled&&(S.isValidating||S.validatingFields||R.isValidating||R.validatingFields)&&((We||Array.from(g.mount)).forEach(Qe=>{Qe&&(nt?set(n.validatingFields,Qe,nt):unset(n.validatingFields,Qe))}),C.state.next({validatingFields:n.validatingFields,isValidating:!isEmptyObject$1(n.validatingFields)}))},j=(We,nt=[],Qe,dt,pt=!0,ft=!0)=>{if(dt&&Qe&&!e.disabled){if(f.action=!0,ft&&Array.isArray(get(o,We))){const ct=Qe(get(o,We),dt.argA,dt.argB);pt&&set(o,We,ct)}if(ft&&Array.isArray(get(n.errors,We))){const ct=Qe(get(n.errors,We),dt.argA,dt.argB);pt&&set(n.errors,We,ct),unsetEmptyArray(n.errors,We)}if((S.touchedFields||R.touchedFields)&&ft&&Array.isArray(get(n.touchedFields,We))){const ct=Qe(get(n.touchedFields,We),dt.argA,dt.argB);pt&&set(n.touchedFields,We,ct)}(S.dirtyFields||R.dirtyFields)&&(n.dirtyFields=getDirtyFields(l,d)),C.state.next({name:We,isDirty:oe(We,nt),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else set(d,We,nt)},q=(We,nt)=>{set(n.errors,We,nt),C.state.next({errors:n.errors})},z=We=>{n.errors=We,C.state.next({errors:n.errors,isValid:!1})},Q=(We,nt,Qe,dt)=>{const pt=get(o,We);if(pt){const ft=get(d,We,isUndefined(Qe)?get(l,We):Qe);isUndefined(ft)||dt&&dt.defaultChecked||nt?set(d,We,nt?ft:getFieldValue(pt._f)):Ae(We,ft),f.mount&&I()}},F=(We,nt,Qe,dt,pt)=>{let ft=!1,ct=!1;const qt={name:We};if(!e.disabled){if(!Qe||dt){(S.isDirty||R.isDirty)&&(ct=n.isDirty,n.isDirty=qt.isDirty=oe(),ft=ct!==qt.isDirty);const ut=deepEqual$1(get(l,We),nt);ct=!!get(n.dirtyFields,We),ut?unset(n.dirtyFields,We):set(n.dirtyFields,We,!0),qt.dirtyFields=n.dirtyFields,ft=ft||(S.dirtyFields||R.dirtyFields)&&ct!==!ut}if(Qe){const ut=get(n.touchedFields,We);ut||(set(n.touchedFields,We,Qe),qt.touchedFields=n.touchedFields,ft=ft||(S.touchedFields||R.touchedFields)&&ut!==Qe)}ft&&pt&&C.state.next(qt)}return ft?qt:{}},O=(We,nt,Qe,dt)=>{const pt=get(n.errors,We),ft=(S.isValid||R.isValid)&&isBoolean(nt)&&n.isValid!==nt;if(e.delayError&&Qe?(b=A(()=>q(We,Qe)),b(e.delayError)):(clearTimeout(_),b=null,Qe?set(n.errors,We,Qe):unset(n.errors,We)),(Qe?!deepEqual$1(pt,Qe):pt)||!isEmptyObject$1(dt)||ft){const ct={...dt,...ft&&isBoolean(nt)?{isValid:nt}:{},errors:n.errors,name:We};n={...n,...ct},C.state.next(ct)}},te=async We=>{M(We,!0);const nt=await e.resolver(d,e.context,getResolverOptions(We||g.mount,o,e.criteriaMode,e.shouldUseNativeValidation));return M(We),nt},ne=async We=>{const{errors:nt}=await te(We);if(We)for(const Qe of We){const dt=get(nt,Qe);dt?set(n.errors,Qe,dt):unset(n.errors,Qe)}else n.errors=nt;return nt},ae=async(We,nt,Qe={valid:!0})=>{for(const dt in We){const pt=We[dt];if(pt){const{_f:ft,...ct}=pt;if(ft){const qt=g.array.has(ft.name),ut=pt._f&&hasPromiseValidation(pt._f);ut&&S.validatingFields&&M([dt],!0);const Mt=await validateField(pt,g.disabled,d,E,e.shouldUseNativeValidation&&!nt,qt);if(ut&&S.validatingFields&&M([dt]),Mt[ft.name]&&(Qe.valid=!1,nt))break;!nt&&(get(Mt,ft.name)?qt?updateFieldArrayRootError(n.errors,Mt,ft.name):set(n.errors,ft.name,Mt[ft.name]):unset(n.errors,ft.name))}!isEmptyObject$1(ct)&&await ae(ct,nt,Qe)}}return Qe.valid},ge=()=>{for(const We of g.unMount){const nt=get(o,We);nt&&(nt._f.refs?nt._f.refs.every(Qe=>!live(Qe)):!live(nt._f.ref))&&Ze(We)}g.unMount=new Set},oe=(We,nt)=>!e.disabled&&(We&&nt&&set(d,We,nt),!deepEqual$1(qe(),l)),je=(We,nt,Qe)=>generateWatchOutput(We,g,{...f.mount?d:isUndefined(nt)?l:isString(We)?{[We]:nt}:nt},Qe,nt),Ne=We=>compact(get(f.mount?d:l,We,e.shouldUnregister?get(l,We,[]):[])),Ae=(We,nt,Qe={})=>{const dt=get(o,We);let pt=nt;if(dt){const ft=dt._f;ft&&(!ft.disabled&&set(d,We,getFieldValueAs(nt,ft)),pt=isHTMLElement(ft.ref)&&isNullOrUndefined(nt)?"":nt,isMultipleSelect(ft.ref)?[...ft.ref.options].forEach(ct=>ct.selected=pt.includes(ct.value)):ft.refs?isCheckBoxInput(ft.ref)?ft.refs.forEach(ct=>{(!ct.defaultChecked||!ct.disabled)&&(Array.isArray(pt)?ct.checked=!!pt.find(qt=>qt===ct.value):ct.checked=pt===ct.value||!!pt)}):ft.refs.forEach(ct=>ct.checked=ct.value===pt):isFileInput(ft.ref)?ft.ref.value="":(ft.ref.value=pt,ft.ref.type||C.state.next({name:We,values:cloneObject(d)})))}(Qe.shouldDirty||Qe.shouldTouch)&&F(We,pt,Qe.shouldTouch,Qe.shouldDirty,!0),Qe.shouldValidate&&Be(We)},$e=(We,nt,Qe)=>{for(const dt in nt){if(!nt.hasOwnProperty(dt))return;const pt=nt[dt],ft=We+"."+dt,ct=get(o,ft);(g.array.has(We)||isObject(pt)||ct&&!ct._f)&&!isDateObject(pt)?$e(ft,pt,Qe):Ae(ft,pt,Qe)}},Fe=(We,nt,Qe={})=>{const dt=get(o,We),pt=g.array.has(We),ft=cloneObject(nt);set(d,We,ft),pt?(C.array.next({name:We,values:cloneObject(d)}),(S.isDirty||S.dirtyFields||R.isDirty||R.dirtyFields)&&Qe.shouldDirty&&C.state.next({name:We,dirtyFields:getDirtyFields(l,d),isDirty:oe(We,ft)})):dt&&!dt._f&&!isNullOrUndefined(ft)?$e(We,ft,Qe):Ae(We,ft,Qe),isWatched(We,g)&&C.state.next({...n}),C.state.next({name:f.mount?We:void 0,values:cloneObject(d)})},ze=async We=>{f.mount=!0;const nt=We.target;let Qe=nt.name,dt=!0;const pt=get(o,Qe),ft=ut=>{dt=Number.isNaN(ut)||isDateObject(ut)&&isNaN(ut.getTime())||deepEqual$1(ut,get(d,Qe,ut))},ct=getValidationModes(e.mode),qt=getValidationModes(e.reValidateMode);if(pt){let ut,Mt;const Ut=nt.type?getFieldValue(pt._f):getEventValue(We),yt=We.type===EVENTS.BLUR||We.type===EVENTS.FOCUS_OUT,nr=!hasValidation(pt._f)&&!e.resolver&&!get(n.errors,Qe)&&!pt._f.deps||skipValidation(yt,get(n.touchedFields,Qe),n.isSubmitted,qt,ct),er=isWatched(Qe,g,yt);set(d,Qe,Ut),yt?(pt._f.onBlur&&pt._f.onBlur(We),b&&b(0)):pt._f.onChange&&pt._f.onChange(We);const lr=F(Qe,Ut,yt),cr=!isEmptyObject$1(lr)||er;if(!yt&&C.state.next({name:Qe,type:We.type,values:cloneObject(d)}),nr)return(S.isValid||R.isValid)&&(e.mode==="onBlur"?yt&&I():yt||I()),cr&&C.state.next({name:Qe,...er?{}:lr});if(!yt&&er&&C.state.next({...n}),e.resolver){const{errors:vr}=await te([Qe]);if(ft(Ut),dt){const Ir=schemaErrorLookup(n.errors,o,Qe),Nr=schemaErrorLookup(vr,o,Ir.name||Qe);ut=Nr.error,Qe=Nr.name,Mt=isEmptyObject$1(vr)}}else M([Qe],!0),ut=(await validateField(pt,g.disabled,d,E,e.shouldUseNativeValidation))[Qe],M([Qe]),ft(Ut),dt&&(ut?Mt=!1:(S.isValid||R.isValid)&&(Mt=await ae(o,!0)));dt&&(pt._f.deps&&Be(pt._f.deps),O(Qe,Mt,ut,lr))}},Ve=(We,nt)=>{if(get(n.errors,nt)&&We.focus)return We.focus(),1},Be=async(We,nt={})=>{let Qe,dt;const pt=convertToArrayPayload(We);if(e.resolver){const ft=await ne(isUndefined(We)?We:pt);Qe=isEmptyObject$1(ft),dt=We?!pt.some(ct=>get(ft,ct)):Qe}else We?(dt=(await Promise.all(pt.map(async ft=>{const ct=get(o,ft);return await ae(ct&&ct._f?{[ft]:ct}:ct)}))).every(Boolean),!(!dt&&!n.isValid)&&I()):dt=Qe=await ae(o);return C.state.next({...!isString(We)||(S.isValid||R.isValid)&&Qe!==n.isValid?{}:{name:We},...e.resolver||!We?{isValid:Qe}:{},errors:n.errors}),nt.shouldFocus&&!dt&&iterateFieldsByAction(o,Ve,We?pt:g.mount),dt},qe=We=>{const nt={...f.mount?d:l};return isUndefined(We)?nt:isString(We)?get(nt,We):We.map(Qe=>get(nt,Qe))},Ke=(We,nt)=>({invalid:!!get((nt||n).errors,We),isDirty:!!get((nt||n).dirtyFields,We),error:get((nt||n).errors,We),isValidating:!!get(n.validatingFields,We),isTouched:!!get((nt||n).touchedFields,We)}),He=We=>{We&&convertToArrayPayload(We).forEach(nt=>unset(n.errors,nt)),C.state.next({errors:We?n.errors:{}})},Xe=(We,nt,Qe)=>{const dt=(get(o,We,{_f:{}})._f||{}).ref,pt=get(n.errors,We)||{},{ref:ft,message:ct,type:qt,...ut}=pt;set(n.errors,We,{...ut,...nt,ref:dt}),C.state.next({name:We,errors:n.errors,isValid:!1}),Qe&&Qe.shouldFocus&&dt&&dt.focus&&dt.focus()},tt=(We,nt)=>isFunction$2(We)?C.state.subscribe({next:Qe=>We(je(void 0,nt),Qe)}):je(We,nt,!0),Ye=We=>C.state.subscribe({next:nt=>{shouldSubscribeByName(We.name,nt.name,We.exact)&&shouldRenderFormState(nt,We.formState||S,Dt,We.reRenderRoot)&&We.callback({values:{...d},...n,...nt})}}).unsubscribe,et=We=>(f.mount=!0,R={...R,...We.formState},Ye({...We,formState:R})),Ze=(We,nt={})=>{for(const Qe of We?convertToArrayPayload(We):g.mount)g.mount.delete(Qe),g.array.delete(Qe),nt.keepValue||(unset(o,Qe),unset(d,Qe)),!nt.keepError&&unset(n.errors,Qe),!nt.keepDirty&&unset(n.dirtyFields,Qe),!nt.keepTouched&&unset(n.touchedFields,Qe),!nt.keepIsValidating&&unset(n.validatingFields,Qe),!e.shouldUnregister&&!nt.keepDefaultValue&&unset(l,Qe);C.state.next({values:cloneObject(d)}),C.state.next({...n,...nt.keepDirty?{isDirty:oe()}:{}}),!nt.keepIsValid&&I()},at=({disabled:We,name:nt})=>{(isBoolean(We)&&f.mount||We||g.disabled.has(nt))&&(We?g.disabled.add(nt):g.disabled.delete(nt))},rt=(We,nt={})=>{let Qe=get(o,We);const dt=isBoolean(nt.disabled)||isBoolean(e.disabled);return set(o,We,{...Qe||{},_f:{...Qe&&Qe._f?Qe._f:{ref:{name:We}},name:We,mount:!0,...nt}}),g.mount.add(We),Qe?at({disabled:isBoolean(nt.disabled)?nt.disabled:e.disabled,name:We}):Q(We,!0,nt.value),{...dt?{disabled:nt.disabled||e.disabled}:{},...e.progressive?{required:!!nt.required,min:getRuleValue(nt.min),max:getRuleValue(nt.max),minLength:getRuleValue(nt.minLength),maxLength:getRuleValue(nt.maxLength),pattern:getRuleValue(nt.pattern)}:{},name:We,onChange:ze,onBlur:ze,ref:pt=>{if(pt){rt(We,nt),Qe=get(o,We);const ft=isUndefined(pt.value)&&pt.querySelectorAll&&pt.querySelectorAll("input,select,textarea")[0]||pt,ct=isRadioOrCheckbox(ft),qt=Qe._f.refs||[];if(ct?qt.find(ut=>ut===ft):ft===Qe._f.ref)return;set(o,We,{_f:{...Qe._f,...ct?{refs:[...qt.filter(live),ft,...Array.isArray(get(l,We))?[{}]:[]],ref:{type:ft.type,name:We}}:{ref:ft}}}),Q(We,!1,void 0,ft)}else Qe=get(o,We,{}),Qe._f&&(Qe._f.mount=!1),(e.shouldUnregister||nt.shouldUnregister)&&!(isNameInFieldArray(g.array,We)&&f.action)&&g.unMount.add(We)}}},it=()=>e.shouldFocusError&&iterateFieldsByAction(o,Ve,g.mount),st=We=>{isBoolean(We)&&(C.state.next({disabled:We}),iterateFieldsByAction(o,(nt,Qe)=>{const dt=get(o,Qe);dt&&(nt.disabled=dt._f.disabled||We,Array.isArray(dt._f.refs)&&dt._f.refs.forEach(pt=>{pt.disabled=dt._f.disabled||We}))},0,!1))},Ue=(We,nt)=>async Qe=>{let dt;Qe&&(Qe.preventDefault&&Qe.preventDefault(),Qe.persist&&Qe.persist());let pt=cloneObject(d);if(C.state.next({isSubmitting:!0}),e.resolver){const{errors:ft,values:ct}=await te();n.errors=ft,pt=ct}else await ae(o);if(g.disabled.size)for(const ft of g.disabled)set(pt,ft,void 0);if(unset(n.errors,"root"),isEmptyObject$1(n.errors)){C.state.next({errors:{}});try{await We(pt,Qe)}catch(ft){dt=ft}}else nt&&await nt({...n.errors},Qe),it(),setTimeout(it);if(C.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:isEmptyObject$1(n.errors)&&!dt,submitCount:n.submitCount+1,errors:n.errors}),dt)throw dt},Rt=(We,nt={})=>{get(o,We)&&(isUndefined(nt.defaultValue)?Fe(We,cloneObject(get(l,We))):(Fe(We,nt.defaultValue),set(l,We,cloneObject(nt.defaultValue))),nt.keepTouched||unset(n.touchedFields,We),nt.keepDirty||(unset(n.dirtyFields,We),n.isDirty=nt.defaultValue?oe(We,cloneObject(get(l,We))):oe()),nt.keepError||(unset(n.errors,We),S.isValid&&I()),C.state.next({...n}))},Je=(We,nt={})=>{const Qe=We?cloneObject(We):l,dt=cloneObject(Qe),pt=isEmptyObject$1(We),ft=pt?l:dt;if(nt.keepDefaultValues||(l=Qe),!nt.keepValues){if(nt.keepDirtyValues){const ct=new Set([...g.mount,...Object.keys(getDirtyFields(l,d))]);for(const qt of Array.from(ct))get(n.dirtyFields,qt)?set(ft,qt,get(d,qt)):Fe(qt,get(ft,qt))}else{if(isWeb&&isUndefined(We))for(const ct of g.mount){const qt=get(o,ct);if(qt&&qt._f){const ut=Array.isArray(qt._f.refs)?qt._f.refs[0]:qt._f.ref;if(isHTMLElement(ut)){const Mt=ut.closest("form");if(Mt){Mt.reset();break}}}}for(const ct of g.mount)Fe(ct,get(ft,ct))}d=cloneObject(ft),C.array.next({values:{...ft}}),C.state.next({values:{...ft}})}g={mount:nt.keepDirtyValues?g.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},f.mount=!S.isValid||!!nt.keepIsValid||!!nt.keepDirtyValues,f.watch=!!e.shouldUnregister,C.state.next({submitCount:nt.keepSubmitCount?n.submitCount:0,isDirty:pt?!1:nt.keepDirty?n.isDirty:!!(nt.keepDefaultValues&&!deepEqual$1(We,l)),isSubmitted:nt.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:pt?{}:nt.keepDirtyValues?nt.keepDefaultValues&&d?getDirtyFields(l,d):n.dirtyFields:nt.keepDefaultValues&&We?getDirtyFields(l,We):nt.keepDirty?n.dirtyFields:{},touchedFields:nt.keepTouched?n.touchedFields:{},errors:nt.keepErrors?n.errors:{},isSubmitSuccessful:nt.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},mt=(We,nt)=>Je(isFunction$2(We)?We(d):We,nt),$t=(We,nt={})=>{const Qe=get(o,We),dt=Qe&&Qe._f;if(dt){const pt=dt.refs?dt.refs[0]:dt.ref;pt.focus&&(pt.focus(),nt.shouldSelect&&isFunction$2(pt.select)&&pt.select())}},Dt=We=>{n={...n,...We}},Vt={control:{register:rt,unregister:Ze,getFieldState:Ke,handleSubmit:Ue,setError:Xe,_subscribe:Ye,_runSchema:te,_focusError:it,_getWatch:je,_getDirty:oe,_setValid:I,_setFieldArray:j,_setDisabledField:at,_setErrors:z,_getFieldArray:Ne,_reset:Je,_resetDefaultValues:()=>isFunction$2(e.defaultValues)&&e.defaultValues().then(We=>{mt(We,e.resetOptions),C.state.next({isLoading:!1})}),_removeUnmounted:ge,_disableForm:st,_subjects:C,_proxyFormState:S,get _fields(){return o},get _formValues(){return d},get _state(){return f},set _state(We){f=We},get _defaultValues(){return l},get _names(){return g},set _names(We){g=We},get _formState(){return n},get _options(){return e},set _options(We){e={...e,...We}}},subscribe:et,trigger:Be,register:rt,handleSubmit:Ue,watch:tt,setValue:Fe,getValues:qe,reset:mt,resetField:Rt,clearErrors:He,unregister:Ze,setError:Xe,setFocus:$t,getFieldState:Ke};return{...Vt,formControl:Vt}}function useForm(t={}){const e=React.useRef(void 0),n=React.useRef(void 0),[o,l]=React.useState({isDirty:!1,isValidating:!1,isLoading:isFunction$2(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$2(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...t.formControl?t.formControl:createFormControl(t),formState:o},t.formControl&&t.defaultValues&&!isFunction$2(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}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:I}}=useForm({defaultValues:_}),M=E(),j=React.useCallback(()=>g?JSON.stringify(M)!==JSON.stringify(g):!1,[M,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,O=!1;const te=Object.keys(Q).map(ne=>({key:ne,keyApi:ne.charAt(0).toUpperCase()+ne.slice(1)}));for(const ne of te){const ae=Q[ne.key],ge=t[ne.keyApi];if(ae!==ge&&ae!==void 0){O=!0;try{await f({applicationId:e,fieldName:ne.keyApi,newValue:String(ae)}).unwrap()||(F=!1)}catch(oe){console.error(`Error updating ${ne.keyApi}:`,oe),F=!1}}}F&&O?(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:I||o,className:o?"hidden":"",children:I?"Saving...":"Save"})})]})]})]})};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
1087
1087
  * react-is.production.min.js
1088
1088
  *
1089
1089
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -1120,12 +1120,12 @@ $10 with opportunities under $1,000`:t==="D"?"$15 under $1,500":t==="E"?"Full sh
1120
1120
  * LICENSE.md file in the root directory of this source tree.
1121
1121
  *
1122
1122
  * @license MIT
1123
- */function flexRender(t,e){return t?isReactComponent(t)?React__namespace.createElement(t,e):t:null}function isReactComponent(t){return isClassComponent(t)||typeof t=="function"||isExoticComponent(t)}function isClassComponent(t){return typeof t=="function"&&(()=>{const e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}function isExoticComponent(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}function useReactTable(t){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...t},[n]=React__namespace.useState(()=>({current:createTable(e)})),[o,l]=React__namespace.useState(()=>n.current.initialState);return n.current.setOptions(d=>({...d,...t,state:{...o,...t.state},onStateChange:f=>{l(f),t.onStateChange==null||t.onStateChange(f)}})),n.current}function DataTable({columns:t,data:e,uniqueValues:n}){var E;const[o,l]=React.useState([]),[d,f]=React.useState([]),[g,b]=React.useState({pageIndex:0,pageSize:10}),[_,S]=React.useState(null),R=useReactTable({data:e,columns:t,getCoreRowModel:getCoreRowModel(),onSortingChange:l,getSortedRowModel:getSortedRowModel(),onColumnFiltersChange:f,getFilteredRowModel:getFilteredRowModel(),getPaginationRowModel:getPaginationRowModel(),onPaginationChange:b,state:{sorting:o,columnFilters:d,pagination:g}}),C=(A,I)=>{A.toggleSorting(I),S(null)};return jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs(ScrollArea,{className:"rounded-md border",children:[jsxRuntime.jsxs(Table,{children:[jsxRuntime.jsx(TableHeader,{children:R.getHeaderGroups().map(A=>jsxRuntime.jsx(TableRow,{children:A.headers.map(I=>{var M;return jsxRuntime.jsx(TableHead,{children:I.isPlaceholder?null:I.column.getCanSort()||I.column.getCanFilter()?jsxRuntime.jsxs(Popover,{open:_===I.id,onOpenChange:j=>S(j?I.id:null),children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:"pl-0",children:[flexRender(I.column.columnDef.header,I.getContext()),I.column.getIsFiltered()?jsxRuntime.jsx(Filter,{className:"ml-2 h-4 w-4"}):I.column.getIsSorted()==="asc"?jsxRuntime.jsx(ArrowUp,{className:"ml-2 h-4 w-4"}):I.column.getIsSorted()==="desc"?jsxRuntime.jsx(ArrowDown,{className:"ml-2 h-4 w-4"}):jsxRuntime.jsx(ArrowUpDown,{className:"ml-2 h-4 w-4"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-56",children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[I.column.getCanSort()&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{variant:"ghost",className:"w-full justify-start",onClick:()=>C(I.column,!1),children:[jsxRuntime.jsx(ArrowUp,{className:"mr-2 h-4 w-4"}),"Sort Ascending"]}),jsxRuntime.jsxs(Button,{variant:"ghost",className:"w-full justify-start",onClick:()=>C(I.column,!0),children:[jsxRuntime.jsx(ArrowDown,{className:"mr-2 h-4 w-4"}),"Sort Descending"]})]}),I.column.getCanFilter()&&jsxRuntime.jsx("div",{className:"px-2 py-1",children:n[I.column.id]?jsxRuntime.jsxs(Select,{onValueChange:j=>I.column.setFilterValue(j==="all"?void 0:[j]),children:[jsxRuntime.jsx(SelectTrigger,{children:jsxRuntime.jsx(SelectValue,{placeholder:`Filter ${I.column.columnDef.header}...`})}),jsxRuntime.jsxs(SelectContent,{children:[jsxRuntime.jsx(SelectItem,{value:"all",children:"All"}),(M=n[I.column.id])==null?void 0:M.map(j=>jsxRuntime.jsx(SelectItem,{value:j||"empty",children:j||"(Empty)"},j))]})]}):jsxRuntime.jsx(Input,{placeholder:`Filter ${I.column.columnDef.header}...`,value:I.column.getFilterValue()??"",onChange:j=>I.column.setFilterValue(j.target.value),className:"w-full"})})]})})]}):jsxRuntime.jsx("div",{className:"py-2 px-4",children:flexRender(I.column.columnDef.header,I.getContext())})},I.id)})},A.id))}),jsxRuntime.jsx(TableBody,{children:(E=R.getRowModel().rows)!=null&&E.length?R.getRowModel().rows.map(A=>jsxRuntime.jsx(TableRow,{"data-state":A.getIsSelected()&&"selected",children:A.getVisibleCells().map(I=>jsxRuntime.jsx(TableCell,{children:flexRender(I.column.columnDef.cell,I.getContext())},I.id))},A.id)):jsxRuntime.jsx(TableRow,{children:jsxRuntime.jsx(TableCell,{colSpan:t.length,className:"h-24 text-center",children:"No results."})})})]}),jsxRuntime.jsx(ScrollBar,{orientation:"horizontal"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Rows per page"}),jsxRuntime.jsxs(Select,{value:`${R.getState().pagination.pageSize}`,onValueChange:A=>{R.setPageSize(Number(A))},children:[jsxRuntime.jsx(SelectTrigger,{className:"h-8 w-[70px]",children:jsxRuntime.jsx(SelectValue,{asChild:!0,children:jsxRuntime.jsx("span",{children:R.getState().pagination.pageSize})})}),jsxRuntime.jsx(SelectContent,{side:"top",children:[10,20,30,40,50].map(A=>jsxRuntime.jsx(SelectItem,{value:`${A}`,children:jsxRuntime.jsx("span",{children:A})},A))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsxs(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>R.setPageIndex(0),disabled:!R.getCanPreviousPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to first page"}),jsxRuntime.jsx(ChevronsLeft,{className:"h-4 w-4"})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>R.previousPage(),disabled:!R.getCanPreviousPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to previous page"}),jsxRuntime.jsx(ChevronLeft,{className:"h-4 w-4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Page"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:R.getState().pagination.pageIndex+1}),jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"of"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:R.getPageCount()})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>R.nextPage(),disabled:!R.getCanNextPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to next page"}),jsxRuntime.jsx(ChevronRight,{className:"h-4 w-4"})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>R.setPageIndex(R.getPageCount()-1),disabled:!R.getCanNextPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to last page"}),jsxRuntime.jsx(ChevronsRight,{className:"h-4 w-4"})]})]})]})]})}function ManufacturerCategories({categories:t,activeCategory:e,onSelectCategory:n}){return jsxRuntime.jsx("div",{className:"grid",children:jsxRuntime.jsx("div",{className:"flex overflow-x-auto small-scrollbar pb-4",children:jsxRuntime.jsx("div",{className:"flex gap-2",children:t.map(o=>jsxRuntime.jsx(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},o.CategoryCode))})})})}function ManufacturerProducts({applicationId:t,manufacturer:e,shopifyHostName:n}){var M,j,q,z;const[o]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeShopifyMutation(),[l,d]=React.useState(((j=(M=e.Categories)==null?void 0:M[0])==null?void 0:j.CategoryCode)||""),[f,g]=React.useState(!1),[b,_]=React.useState(!1),{toast:S}=useToast(),{data:R,isLoading:C,isFetching:E}=useGetV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeQuery({routeResellerId:t,manufacturerId:e.ManufacturerId,categoryCode:l??""},{skip:!e.ManufacturerId||!l}),A=async()=>{try{g(!0),_(!1),await o({routeResellerId:t,manufacturerId:e.ManufacturerId??"",categoryCode:l,shopifyHostName:n}).unwrap()&&S({title:"Success",description:"Category synced to Shopify successfully",variant:"success"})}catch(Q){console.error("Error syncing to Shopify:",Q),S({title:"Error",description:"Error syncing category to Shopify.",variant:"destructive"})}finally{g(!1)}},I=()=>{var Q,F;return((F=(Q=e.Categories)==null?void 0:Q.find(O=>O.CategoryCode===l))==null?void 0:F.CategoryName)||l};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(ManufacturerCategories,{categories:e.Categories||[],activeCategory:l,onSelectCategory:d}),n&&((q=e.Categories)==null?void 0:q.findIndex(Q=>Q.AvailableToBuy))!==-1&&jsxRuntime.jsxs(Dialog,{open:b,onOpenChange:_,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700 mb-4",disabled:f,children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2 h-4 w-4"}),"Sync Category to Shopify"]})})}),jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Confirm Sync to Shopify"}),jsxRuntime.jsxs(DialogDescription,{children:['Are you sure you want to sync the category "',I(),'" to Shopify? This will add all products in this category to your Shopify store.']})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>_(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",onClick:A,disabled:f,children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):"Confirm Sync"})]})]})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @md:grid-cols-2 @lg: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==null?void 0:R.Products)==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",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Warning"}),jsxRuntime.jsx(AlertDescription,{children:"No products found for this manufacturer category."})]})})]})}function PartnerRelationshipPage({applicationId:t,partnerId:e,userEmail:n,shopifyHostName:o,isSuperAdmin:l}){var I,M,j;const{data:d,isLoading:f}=useGetV4PartnerByRouteApplicationIdPartnerAndPartnerIdQuery({routeApplicationId:t,partnerId:e,withSpecification:!0}),{toast:g}=useToast(),[b]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdShopifyMutation(),[_,S]=React.useState(!1),[R,C]=React.useState(!1),E=async()=>{try{S(!0),C(!1),await b({routeResellerId:t??"",manufacturerId:e??"",shopifyHostName:o}).unwrap()&&g({title:"Success",description:"Manufacturer synced to Shopify successfully",variant:"success"})}catch(q){console.error("Error syncing to Shopify:",q),g({title:"Error",description:"Error syncing manufacturer to Shopify.",variant:"destructive"})}finally{S(!1)}},A=()=>d!=null&&d.Reseller?"reseller-overview":d!=null&&d.Manufacturer?"manufacturer-overview":"";return jsxRuntime.jsxs("div",{className:"@container",children:[jsxRuntime.jsxs("div",{className:"grid gap-4 grid-cols-1 @md:grid-cols-1 @lg:grid-cols-2",children:[jsxRuntime.jsx(PartnerCard,{account:d,loading:f,withAbout:!0,withVoice:!1,action:" "}),jsxRuntime.jsxs("div",{className:"grid gap-4",children:[((d==null?void 0:d.Manufacturer)||f)&&jsxRuntime.jsx(ManufacturerCard,{manufacturer:d==null?void 0:d.Manufacturer,loading:f,mainAction:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(ManufacturerGetStartedButton,{applicationId:t,manufacturer:d==null?void 0:d.Manufacturer}),o&&((M=(I=d==null?void 0:d.Manufacturer)==null?void 0:I.Categories)==null?void 0:M.findIndex(q=>q.AvailableToBuy))!==-1&&jsxRuntime.jsxs(Dialog,{open:R,onOpenChange:C,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700 ml-2",disabled:_,children:_?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2 h-4 w-4"}),"Sync Manufacturer to Shopify"]})})}),jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Confirm Sync to Shopify"}),jsxRuntime.jsxs(DialogDescription,{children:['Are you sure you want to sync the manufacturer "',(j=d==null?void 0:d.Manufacturer)==null?void 0:j.PublicName,'" to Shopify? This will add all products from this manufacturer to your Shopify store.']})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",onClick:E,disabled:_,children:_?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):"Confirm Sync"})]})]})]})]})}),(d==null?void 0:d.Reseller)&&jsxRuntime.jsx(ResellerCard,{reseller:d==null?void 0:d.Reseller,loading:f})]})]}),((d==null?void 0:d.Reseller)||(d==null?void 0:d.Manufacturer))&&!f&&jsxRuntime.jsx("div",{className:"max-w-6xl mx-auto p-4",children:jsxRuntime.jsxs(Tabs,{defaultValue:A(),className:"w-full",children:[jsxRuntime.jsxs(TabsList,{className:"inline-flex h-auto items-center justify-center rounded-none border-b bg-transparent p-0",children:[(d==null?void 0:d.Reseller)&&jsxRuntime.jsx(TabsTrigger,{value:"reseller-overview",className:"reseller-theme relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Reseller Overview"}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsTrigger,{value:"manufacturer-overview",className:"manufacturer-theme relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Manufacturer Overview"}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsTrigger,{value:"products",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Products"})]}),(d==null?void 0:d.Reseller)&&jsxRuntime.jsx(TabsContent,{value:"reseller-overview",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ResellerOverview,{readonly:!0,appID:d.ApplicationId||"",reseller:d==null?void 0:d.Reseller,userEmail:n,isSuperAdmin:l,withoutReports:!0})})}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsContent,{value:"manufacturer-overview",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ManufacturerOverviewPage,{readonly:!0,manufacturer:d==null?void 0:d.Manufacturer,applicationId:d.ApplicationId||"",userEmail:n})})}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsContent,{value:"products",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ManufacturerProducts,{applicationId:t,manufacturer:d.Manufacturer,shopifyHostName:o})})})]})}),f&&jsxRuntime.jsx("div",{className:"max-w-6xl mx-auto p-4 mt-4 flex justify-center items-center h-32",children:jsxRuntime.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin text-primary"})})]})}function ManufacturerBillingInfoSection({manufacturer:t,readonly:e=!1,isLoading:n,onUnsavedChanges:o}){const{toast:l}=useToast(),[d]=usePostV4PartnerByApplicationIdAccountManufacturerAndFieldNameMutation(),[f,g]=React.useState({}),b=React.useMemo(()=>({accountsPayableRep:(t==null?void 0:t.ContactName)??"",representativeEmail:(t==null?void 0:t.RepresentativeEmail)??"",phone:(t==null?void 0:t.Phone)??"",creditLimit:(t==null?void 0:t.CreditLimit)??0,terms:(t==null?void 0:t.Terms)??""}),[t]),{register:_,handleSubmit:S,reset:R,watch:C,formState:{errors:E,isSubmitting:A}}=useForm({defaultValues:b}),I=C(),M=React.useCallback(()=>e||!f?!1:JSON.stringify(I)!==JSON.stringify(f),[e,I,f]);React.useEffect(()=>{o&&o(M())},[M,o]),React.useEffect(()=>{t&&(R(b),g(b))},[t,R,b]);const j=async q=>{if(e)return;let z=!0,Q=!1;const F=[{key:"accountsPayableRep",apiKey:"ContactName",value:q.accountsPayableRep},{key:"representativeEmail",apiKey:"RepresentativeEmail",value:q.representativeEmail},{key:"phone",apiKey:"Phone",value:q.phone},{key:"terms",apiKey:"Terms",value:q.terms}];for(const O of F){const te=O.value,ne=t==null?void 0:t[O.apiKey];if(te!==ne&&te!==void 0){Q=!0;try{await d({applicationId:(t==null?void 0:t.ManufacturerId)??"",fieldName:O.apiKey,newValue:String(te)}).unwrap()||(z=!1,console.error(`Failed to update ${O.apiKey}`))}catch(ae){console.error(`Error updating ${O.apiKey}:`,ae),z=!1}}}z&&Q?(l({title:"Billing info",description:"Information updated successfully",variant:"success"}),g({...q}),o&&o(!1)):z?Q||l({title:"No changes",description:"No changes were made to the information.",variant:"info"}):l({title:"Update error",description:"Failed to update. Please try again.",variant:"destructive"})};return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Billing, Credit, & Rebates"})}),jsxRuntime.jsx(CardContent,{children:n?jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-16"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-16"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"})]}):jsxRuntime.jsxs("form",{onSubmit:S(j),className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"accountsPayableRep",children:"Accounts Payable Representative"}),jsxRuntime.jsx(Input,{id:"accountsPayableRep",placeholder:"John Doe",..._("accountsPayableRep"),readOnly:e})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"representativeEmail",children:"Representative Email"}),jsxRuntime.jsx(Input,{id:"representativeEmail",placeholder:"john.doe@company.com",..._("representativeEmail",{pattern:{value:/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,message:"Invalid email address"}}),readOnly:e}),E.representativeEmail&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:E.representativeEmail.message})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"phone",children:"Phone"}),jsxRuntime.jsx(Input,{id:"phone",placeholder:"(555) 123-4567",..._("phone"),readOnly:e})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"creditLimit",children:"Credit Limit"}),jsxRuntime.jsx("div",{className:"p-2 border rounded-md bg-gray-100",children:jsxRuntime.jsx(FormattedNumber,{value:(t==null?void 0:t.CreditLimit)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"})})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"terms",children:"Terms"}),jsxRuntime.jsx(Input,{id:"terms",placeholder:"NET 30 DAYS",..._("terms"),readOnly:!0})]}),!e&&jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Button,{type:"submit",disabled:A,className:"w-full sm:w-auto",children:A?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})})]})})]})}function OpenToWorkSection({manufacturer:t,readonly:e=!1,isLoading:n}){const{toast:o}=useToast(),[l]=usePostV4PartnerByApplicationIdAccountManufacturerAndFieldNameMutation(),d=React.useMemo(()=>({openToWork:(t==null?void 0:t.OpenToWork)??!1}),[t]),{reset:f,watch:g}=useForm({defaultValues:d});React.useEffect(()=>{t&&f(d)},[t,f,d]);const b=async _=>{if(!e)try{await l({applicationId:(t==null?void 0:t.ManufacturerId)??"",fieldName:"OpenToWork",newValue:_?"true":"false"}).unwrap()&&o({title:"Open to work info",description:"Information updated successfully",variant:"success"})}catch(S){console.error("Error updating",S)}};return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Open to Work with Resellers"})}),jsxRuntime.jsx(CardContent,{children:n?jsxRuntime.jsx("div",{className:"space-y-4",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"})}):jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Resellers will be introducing their business, and communicating opportunities for your Brand through Randmar."}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"You'll engage directly with resellers, allow them to learn about your product lines, and grow your business faster."}),jsxRuntime.jsx("br",{}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Switch,{id:"openToWork",checked:g("openToWork"),onCheckedChange:_=>b(_),disabled:e}),jsxRuntime.jsx(Label$2,{htmlFor:"openToWork",children:"Open to work with Resellers"})]})]})})]})}const tagSuggestions=["Arts and Crafts","Cleaning Solutions","Clothing","Electronics","Generic Compatible Toner","Ink","Luggage and Bags","Miscellaneous","Networking Devices","Paper Products","Printers","Printing Supplies","Toner"];function ManufacturerPublicInfoSection({manufacturer:t,readonly:e=!1,isLoading:n,onUnsavedChanges:o}){const{toast:l}=useToast(),[d]=usePostV4PartnerByApplicationIdAccountManufacturerAndFieldNameMutation(),[f,g]=React.useState([]),[b,_]=React.useState({}),S=React.useMemo(()=>({publicName:(t==null?void 0:t.PublicName)??"",website:(t==null?void 0:t.Website)??"",customerServiceEmail:(t==null?void 0:t.PublicEmail)??"",publicResources:(t==null?void 0:t.PublicResourcesLink)??""}),[t]),{register:R,handleSubmit:C,reset:E,watch:A,formState:{errors:I,isSubmitting:M}}=useForm({defaultValues:S}),j=A(),q=React.useCallback(()=>e||!b?!1:JSON.stringify(j)!==JSON.stringify(b),[e,j,b]);React.useEffect(()=>{o&&o(q())},[q,o]),React.useEffect(()=>{t&&(E(S),g(t.Tags?t.Tags.split(",").map(O=>O.trim()):[]),_(S))},[t,E,S]);const z=async O=>{if(e)return;let te=!0,ne=!1;const ae=[{key:"publicName",apiKey:"PublicName",value:O.publicName},{key:"website",apiKey:"Website",value:O.website},{key:"manufacturerCategories",apiKey:"Tags",value:f.join(", ")},{key:"customerServiceEmail",apiKey:"PublicEmail",value:O.customerServiceEmail},{key:"publicResources",apiKey:"PublicResourcesLink",value:O.publicResources}];for(const ge of ae){const oe=ge.value,je=t==null?void 0:t[ge.apiKey],Ne=typeof je=="boolean"?String(je):je;if(oe!==Ne&&oe!==void 0){ne=!0;try{await d({applicationId:(t==null?void 0:t.ManufacturerId)??"",fieldName:ge.apiKey,newValue:String(oe)}).unwrap()||(te=!1)}catch(Ae){console.error(`Error updating ${ge.apiKey}:`,Ae),te=!1}}}te&&ne?(l({title:"Public info",description:"Information updated successfully",variant:"success"}),_({...O}),o&&o(!1)):te||l({title:"Update error",description:"Failed to update",variant:"destructive"})},Q=O=>!O||O.trim()==="",F=O=>{g(O)};return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Public Information"})}),jsxRuntime.jsx(CardContent,{children:n?jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[(Q(A("publicName"))||Q(A("website"))||Q(A("customerServiceEmail")))&&jsxRuntime.jsxs(Alert,{variant:"destructive",className:"mb-6",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Missing information"}),jsxRuntime.jsx(AlertDescription,{children:"All fields are required to get started at working with Resellers."})]}),jsxRuntime.jsxs("form",{onSubmit:C(z),className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"publicName",children:"Public Manufacturer Name *"}),jsxRuntime.jsx(Input,{id:"publicName",placeholder:"Company Name",...R("publicName",{}),className:Q(A("publicName"))?"input-error-indicator":"",readOnly:e}),I.publicName&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:I.publicName.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"website",children:"Website *"}),jsxRuntime.jsx(Input,{id:"website",placeholder:"https://company.com",...R("website",{pattern:{value:/^.{7,}$/,message:"Must be at least 7 characters"}}),className:Q(A("website"))?"input-error-indicator":"",readOnly:e}),I.website&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:I.website.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"manufacturerCategories",children:"Manufacturer Categories"}),jsxRuntime.jsx(MultiSelect,{options:tagSuggestions,selected:f,onChange:F,placeholder:"Select or type categories...",disabled:e})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"customerServiceEmail",children:"Customer Service Email *"}),jsxRuntime.jsx(Input,{id:"customerServiceEmail",placeholder:"support@company.com",...R("customerServiceEmail",{pattern:{value:/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,message:"Invalid email address"}}),className:Q(A("customerServiceEmail"))?"input-error-indicator":"",readOnly:e}),I.customerServiceEmail&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:I.customerServiceEmail.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"publicResources",children:"Public Resources"}),jsxRuntime.jsx(Input,{id:"publicResources",placeholder:"https://resources.company.com",...R("publicResources"),readOnly:e})]}),!e&&jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Button,{type:"submit",disabled:M,className:"w-full sm:w-auto",children:M?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})})]})]})})]})}function ManufacturerQualificationsSection({manufacturer:t,readonly:e=!1,isLoading:n,onUnsavedChanges:o}){const{toast:l}=useToast(),[d]=usePostV4PartnerByApplicationIdAccountManufacturerAndFieldNameMutation(),[f,g]=React.useState({}),b=React.useMemo(()=>({partnerPortal:(t==null?void 0:t.PartnerPortal)??"",partnerRegistrationLink:(t==null?void 0:t.PartnerRegistrationLink)??""}),[t]),{register:_,handleSubmit:S,reset:R,watch:C,formState:{errors:E,isSubmitting:A}}=useForm({defaultValues:b}),I=C(),M=React.useCallback(()=>e||!f?!1:JSON.stringify(I)!==JSON.stringify(f),[e,I,f]);React.useEffect(()=>{o&&o(M())},[M,o]),React.useEffect(()=>{t&&(R(b),g(b))},[t,R,b]);const j=async z=>{if(e)return!1;let Q=!0,F=!1;const O=[{key:"partnerPortal",apiKey:"PartnerPortal",value:z.partnerPortal},{key:"partnerRegistrationLink",apiKey:"PartnerRegistrationLink",value:z.partnerRegistrationLink}];for(const te of O){const ne=te.value,ae=t==null?void 0:t[te.apiKey];if(ne!==ae&&ne!==void 0){F=!0;try{await d({applicationId:(t==null?void 0:t.ManufacturerId)??"",fieldName:te.apiKey,newValue:String(ne)}).unwrap()||(Q=!1,console.error(`Failed to update ${te.apiKey}`))}catch(ge){console.error(`Error updating ${te.apiKey}:`,ge),Q=!1}}}Q&&F?(l({title:"Qualifications info",description:"Information updated successfully",variant:"success"}),g({...z}),o&&o(!1)):Q?F||l({title:"No changes",description:"No changes were made to the information.",variant:"info"}):l({title:"Update error",description:"Failed to update. Please try again.",variant:"destructive"})},q=/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?(\?[^\s#]*)??(#[^\s]*)?$/i;return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Qualifications"})}),jsxRuntime.jsx(CardContent,{children:n?jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"})]}):jsxRuntime.jsxs("form",{onSubmit:S(j),className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"partnerPortal",children:"Partner Portal"}),jsxRuntime.jsx(Input,{id:"partnerPortal",placeholder:"https://partner.example.com",..._("partnerPortal",{pattern:{value:q,message:"Invalid URL format"}}),readOnly:e}),E.partnerPortal&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:E.partnerPortal.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"partnerRegistrationLink",children:"Partner Registration Link"}),jsxRuntime.jsx(Input,{id:"partnerRegistrationLink",placeholder:"https://register.example.com",..._("partnerRegistrationLink",{pattern:{value:q,message:"Invalid URL format"}}),readOnly:e}),E.partnerRegistrationLink&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:E.partnerRegistrationLink.message})]}),!e&&jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Button,{type:"submit",disabled:A,className:"w-full sm:w-auto",children:A?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})})]})})]})}function ManufacturerReportsSection({manufacturerId:t,userEmail:e,isLoading:n}){const{toast:o}=useToast(),[l,{isLoading:d}]=usePostV4ManufacturerByRouteManufacturerIdDocumentAndDocumentNumberEmailMutation(),[f,g]=React.useState(null),[b,_]=React.useState(e),[S,R]=React.useState(!1),C=[{name:"Orders & Sales",reports:[{id:"OpenOrders",title:"Open Orders Report",description:"The Open Orders Report provides a snapshot of active orders, aiding your business in efficiently tracking and fulfilling customer demands.",icon:FileText},{id:"Sales",title:"Sales Report",description:"Summary of your company's sales activity over a certain period, detailing total sales and helping identifying trends, successes, and areas needing improvement.",icon:ChartNoAxesColumnIncreasing}]},{name:"Purchase Orders",reports:[{id:"PurchasedOrders",title:"Open Purchase Orders Report",description:"The Open Purchase Orders Report provides a snapshot of Randmar's active orders, aiding your business in efficiently tracking and fulfilling Randmar's inventory demands.",icon:ShoppingCart},{id:"Reorder",title:"Reordering Report",description:"The Reordering Report provides a snapshot of all part numbers auto-reordering statuses. Aiding your understanding of what will be automatically reordered by our system or not once the inventory reaches low numbers.",icon:ClipboardList}]},{name:"Inventory",reports:[{id:"Inventory",title:"Inventory Report",description:"Detailed document outlining the quantity, type, and value of products Randmar has on hand. It aids in managing stock levels, identifying shortages or surpluses, and informing purchasing decisions.",icon:Package},{id:"Products",title:"Products Report",description:"Detailed document outlining all your products properties. It provides a comprehensive overview of essential information and insights that help you make informed decisions.",icon:ClipboardList}]}],E=async I=>{g(I),R(!0)},A=async()=>{if(!(!f||!t))try{await l({routeManufacturerId:t,documentNumber:f.id,emailAddress:b}).unwrap(),o({title:"Report requested",description:`The ${f.title} will be sent to ${b} shortly.`,variant:"success"}),R(!1),_("")}catch(I){console.error("Error requesting report:",I),o({title:"Error",description:"Failed to request report. Please try again.",variant:"destructive"})}};return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reports"}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Download essential business reports, from your Open Orders & Sales Report, to your Inventory Reports."})]}),jsxRuntime.jsx(CardContent,{className:"space-y-6",children:n?jsxRuntime.jsx(jsxRuntime.Fragment,{children:[1,2,3].map(I=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-48"}),[1,2].map(M=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"})]},M))]},I))}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:C.map(I=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold",children:I.name}),I.reports.map(M=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg hover:bg-gray-100 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:jsxRuntime.jsx(M.icon,{className:"h-5 w-5 text-primary"})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h4",{className:"font-semibold text-sm",children:M.title}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:M.description})]}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",className:"flex items-center gap-1",onClick:()=>E(M),children:[jsxRuntime.jsx(Download,{className:"h-4 w-4"}),"Request"]})]},M.id))]},I.name))})}),jsxRuntime.jsx(Dialog,{open:S,onOpenChange:R,children:jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsxs(DialogTitle,{children:["Request ",f==null?void 0:f.title]}),jsxRuntime.jsx(DialogDescription,{children:"Enter the email address where you would like to receive the report."})]}),jsxRuntime.jsxs("div",{className:"py-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",value:b,onChange:I=>_(I.target.value),placeholder:"your@email.com",className:"mt-2"})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>R(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:A,disabled:!b||d,children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):"Send Report"})]})]})})]})}function ManufacturerResellerOrdersSection(t){const{data:e,isLoading:n,isError:o}=useGetV4ManufacturerByRouteManufacturerIdDocumentsActiveOrderDetailsQuery({routeManufacturerId:t.manufacturerId},{skip:!!t.activeOrders||t.isLoading}),l=t.activeOrders??e,f=(()=>{if(!l)return{all:{orders:0,amount:0},processing:{orders:0,amount:0},shipped:{orders:0,amount:0},delayed:{orders:0,amount:0}};const b=l.filter(Q=>Q.DocumentType==="Order"),_=l.filter(Q=>Q.DocumentType==="Shipment"),S=b.filter(Q=>Q.WarehouseCode!=="3PLE"),R=S.reduce((Q,F)=>Q+(F.Quantity||0),0),C=S.reduce((Q,F)=>Q+(F.ExtendedPrice||0),0),E=b.filter(Q=>Q.WarehouseCode==="3PLE"),A=E.reduce((Q,F)=>Q+(F.Quantity||0),0),I=E.reduce((Q,F)=>Q+(F.ExtendedPrice||0),0),M=_.length,j=_.reduce((Q,F)=>Q+(F.ExtendedPrice||0),0),q=R+A+M,z=C+I+j;return{all:{orders:q,amount:z},processing:{orders:R,amount:C},shipped:{orders:M,amount:j},delayed:{orders:A,amount:I}}})(),g=[{name:"All",icon:Package,color:"bg-blue-500",orders:f.all.orders,amount:f.all.amount},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",orders:f.processing.orders,amount:f.processing.amount},{name:"Shipped",icon:Truck,color:"bg-green-500",orders:f.shipped.orders,amount:f.shipped.amount},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",orders:f.delayed.orders,amount:f.delayed.amount}];return n||t.isLoading?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reseller Orders"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-40 mb-4"}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:[1,2,3,4].map(b=>jsxRuntime.jsx(Skeleton,{className:"h-32 w-full"},b))})]})]}):o?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reseller Orders"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsxs(Alert,{variant:"destructive",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Error"}),jsxRuntime.jsx(AlertDescription,{children:"Failed to load reseller orders. Please try again later."})]})})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reseller Orders"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"flex items-center mb-4",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Active Orders:"}),jsxRuntime.jsx("span",{className:"ml-2 font-bold",children:f.all.orders})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:g.map(b=>jsxRuntime.jsx(Card,{className:"overflow-hidden rounded-md rounded-b-lg border-0 shadow-md",children:jsxRuntime.jsxs(CardContent,{className:"p-0",children:[jsxRuntime.jsx("div",{className:`${b.color} bg-opacity-60 h-[3px]`}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-base",children:b.name}),jsxRuntime.jsx("div",{className:`${b.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(b.icon,{className:"size-4 shrink-0 text-white"})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Orders"}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:b.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:jsxRuntime.jsx(FormattedNumber,{value:b.amount,style:"currency",currency:"CAD",currencyDisplay:"symbol"})})]})]})]})]})},b.name))})]})]})}var PROGRESS_NAME="Progress",DEFAULT_MAX=100,[createProgressContext,createProgressScope]=createContextScope(PROGRESS_NAME),[ProgressProvider,useProgressContext]=createProgressContext(PROGRESS_NAME),Progress$1=React__namespace.forwardRef((t,e)=>{const{__scopeProgress:n,value:o=null,max:l,getValueLabel:d=defaultGetValueLabel,...f}=t;(l||l===0)&&!isValidMaxNumber(l)&&console.error(getInvalidMaxError(`${l}`,"Progress"));const g=isValidMaxNumber(l)?l:DEFAULT_MAX;o!==null&&!isValidValueNumber(o,g)&&console.error(getInvalidValueError(`${o}`,"Progress"));const b=isValidValueNumber(o,g)?o:null,_=isNumber$1(b)?d(b,g):void 0;return jsxRuntime.jsx(ProgressProvider,{scope:n,value:b,max:g,children:jsxRuntime.jsx(Primitive.div,{"aria-valuemax":g,"aria-valuemin":0,"aria-valuenow":isNumber$1(b)?b:void 0,"aria-valuetext":_,role:"progressbar","data-state":getProgressState(b,g),"data-value":b??void 0,"data-max":g,...f,ref:e})})});Progress$1.displayName=PROGRESS_NAME;var INDICATOR_NAME="ProgressIndicator",ProgressIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeProgress:n,...o}=t,l=useProgressContext(INDICATOR_NAME,n);return jsxRuntime.jsx(Primitive.div,{"data-state":getProgressState(l.value,l.max),"data-value":l.value??void 0,"data-max":l.max,...o,ref:e})});ProgressIndicator.displayName=INDICATOR_NAME;function defaultGetValueLabel(t,e){return`${Math.round(t/e*100)}%`}function getProgressState(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function isNumber$1(t){return typeof t=="number"}function isValidMaxNumber(t){return isNumber$1(t)&&!isNaN(t)&&t>0}function isValidValueNumber(t,e){return isNumber$1(t)&&!isNaN(t)&&t<=e&&t>=0}function getInvalidMaxError(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${DEFAULT_MAX}\`.`}function getInvalidValueError(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be:
1123
+ */function flexRender(t,e){return t?isReactComponent(t)?React__namespace.createElement(t,e):t:null}function isReactComponent(t){return isClassComponent(t)||typeof t=="function"||isExoticComponent(t)}function isClassComponent(t){return typeof t=="function"&&(()=>{const e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}function isExoticComponent(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}function useReactTable(t){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...t},[n]=React__namespace.useState(()=>({current:createTable(e)})),[o,l]=React__namespace.useState(()=>n.current.initialState);return n.current.setOptions(d=>({...d,...t,state:{...o,...t.state},onStateChange:f=>{l(f),t.onStateChange==null||t.onStateChange(f)}})),n.current}function DataTable({columns:t,data:e,uniqueValues:n}){var E;const[o,l]=React.useState([]),[d,f]=React.useState([]),[g,b]=React.useState({pageIndex:0,pageSize:10}),[_,S]=React.useState(null),R=useReactTable({data:e,columns:t,getCoreRowModel:getCoreRowModel(),onSortingChange:l,getSortedRowModel:getSortedRowModel(),onColumnFiltersChange:f,getFilteredRowModel:getFilteredRowModel(),getPaginationRowModel:getPaginationRowModel(),onPaginationChange:b,state:{sorting:o,columnFilters:d,pagination:g}}),C=(A,I)=>{A.toggleSorting(I),S(null)};return jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs(ScrollArea,{className:"rounded-md border",children:[jsxRuntime.jsxs(Table,{children:[jsxRuntime.jsx(TableHeader,{children:R.getHeaderGroups().map(A=>jsxRuntime.jsx(TableRow,{children:A.headers.map(I=>{var M;return jsxRuntime.jsx(TableHead,{children:I.isPlaceholder?null:I.column.getCanSort()||I.column.getCanFilter()?jsxRuntime.jsxs(Popover,{open:_===I.id,onOpenChange:j=>S(j?I.id:null),children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:"pl-0",children:[flexRender(I.column.columnDef.header,I.getContext()),I.column.getIsFiltered()?jsxRuntime.jsx(Filter,{className:"ml-2 h-4 w-4"}):I.column.getIsSorted()==="asc"?jsxRuntime.jsx(ArrowUp,{className:"ml-2 h-4 w-4"}):I.column.getIsSorted()==="desc"?jsxRuntime.jsx(ArrowDown,{className:"ml-2 h-4 w-4"}):jsxRuntime.jsx(ArrowUpDown,{className:"ml-2 h-4 w-4"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-56",children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[I.column.getCanSort()&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{variant:"ghost",className:"w-full justify-start",onClick:()=>C(I.column,!1),children:[jsxRuntime.jsx(ArrowUp,{className:"mr-2 h-4 w-4"}),"Sort Ascending"]}),jsxRuntime.jsxs(Button,{variant:"ghost",className:"w-full justify-start",onClick:()=>C(I.column,!0),children:[jsxRuntime.jsx(ArrowDown,{className:"mr-2 h-4 w-4"}),"Sort Descending"]})]}),I.column.getCanFilter()&&jsxRuntime.jsx("div",{className:"px-2 py-1",children:n[I.column.id]?jsxRuntime.jsxs(Select,{onValueChange:j=>I.column.setFilterValue(j==="all"?void 0:[j]),children:[jsxRuntime.jsx(SelectTrigger,{children:jsxRuntime.jsx(SelectValue,{placeholder:`Filter ${I.column.columnDef.header}...`})}),jsxRuntime.jsxs(SelectContent,{children:[jsxRuntime.jsx(SelectItem,{value:"all",children:"All"}),(M=n[I.column.id])==null?void 0:M.map(j=>jsxRuntime.jsx(SelectItem,{value:j||"empty",children:j||"(Empty)"},j))]})]}):jsxRuntime.jsx(Input,{placeholder:`Filter ${I.column.columnDef.header}...`,value:I.column.getFilterValue()??"",onChange:j=>I.column.setFilterValue(j.target.value),className:"w-full"})})]})})]}):jsxRuntime.jsx("div",{className:"py-2 px-4",children:flexRender(I.column.columnDef.header,I.getContext())})},I.id)})},A.id))}),jsxRuntime.jsx(TableBody,{children:(E=R.getRowModel().rows)!=null&&E.length?R.getRowModel().rows.map(A=>jsxRuntime.jsx(TableRow,{"data-state":A.getIsSelected()&&"selected",children:A.getVisibleCells().map(I=>jsxRuntime.jsx(TableCell,{children:flexRender(I.column.columnDef.cell,I.getContext())},I.id))},A.id)):jsxRuntime.jsx(TableRow,{children:jsxRuntime.jsx(TableCell,{colSpan:t.length,className:"h-24 text-center",children:"No results."})})})]}),jsxRuntime.jsx(ScrollBar,{orientation:"horizontal"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Rows per page"}),jsxRuntime.jsxs(Select,{value:`${R.getState().pagination.pageSize}`,onValueChange:A=>{R.setPageSize(Number(A))},children:[jsxRuntime.jsx(SelectTrigger,{className:"h-8 w-[70px]",children:jsxRuntime.jsx(SelectValue,{asChild:!0,children:jsxRuntime.jsx("span",{children:R.getState().pagination.pageSize})})}),jsxRuntime.jsx(SelectContent,{side:"top",children:[10,20,30,40,50].map(A=>jsxRuntime.jsx(SelectItem,{value:`${A}`,children:jsxRuntime.jsx("span",{children:A})},A))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsxs(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>R.setPageIndex(0),disabled:!R.getCanPreviousPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to first page"}),jsxRuntime.jsx(ChevronsLeft,{className:"h-4 w-4"})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>R.previousPage(),disabled:!R.getCanPreviousPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to previous page"}),jsxRuntime.jsx(ChevronLeft,{className:"h-4 w-4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Page"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:R.getState().pagination.pageIndex+1}),jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"of"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:R.getPageCount()})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>R.nextPage(),disabled:!R.getCanNextPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to next page"}),jsxRuntime.jsx(ChevronRight,{className:"h-4 w-4"})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>R.setPageIndex(R.getPageCount()-1),disabled:!R.getCanNextPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to last page"}),jsxRuntime.jsx(ChevronsRight,{className:"h-4 w-4"})]})]})]})]})}function ManufacturerCategories({categories:t,activeCategory:e,onSelectCategory:n}){return jsxRuntime.jsx("div",{className:"grid",children:jsxRuntime.jsx("div",{className:"flex overflow-x-auto small-scrollbar pb-4",children:jsxRuntime.jsx("div",{className:"flex gap-2",children:t.map(o=>jsxRuntime.jsx(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.QualificationRequired&&jsxRuntime.jsx(ShieldCheck,{className:`ml-1 w-5 h-5 ${e!==o.CategoryCode?"text-red-500":""}`})},o.CategoryCode))})})})}function ManufacturerProducts({applicationId:t,manufacturer:e,shopifyHostName:n}){var M,j,q,z;const[o]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeShopifyMutation(),[l,d]=React.useState(((j=(M=e.Categories)==null?void 0:M[0])==null?void 0:j.CategoryCode)||""),[f,g]=React.useState(!1),[b,_]=React.useState(!1),{toast:S}=useToast(),{data:R,isLoading:C,isFetching:E}=useGetV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeQuery({routeResellerId:t,manufacturerId:e.ManufacturerId,categoryCode:l??""},{skip:!e.ManufacturerId||!l}),A=async()=>{try{g(!0),_(!1),await o({routeResellerId:t,manufacturerId:e.ManufacturerId??"",categoryCode:l,shopifyHostName:n}).unwrap()&&S({title:"Success",description:"Category synced to Shopify successfully",variant:"success"})}catch(Q){console.error("Error syncing to Shopify:",Q),S({title:"Error",description:"Error syncing category to Shopify.",variant:"destructive"})}finally{g(!1)}},I=()=>{var Q,F;return((F=(Q=e.Categories)==null?void 0:Q.find(O=>O.CategoryCode===l))==null?void 0:F.CategoryName)||l};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(ManufacturerCategories,{categories:e.Categories||[],activeCategory:l,onSelectCategory:d}),n&&((q=e.Categories)==null?void 0:q.findIndex(Q=>Q.AvailableToBuy))!==-1&&jsxRuntime.jsxs(Dialog,{open:b,onOpenChange:_,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700 mb-4",disabled:f,children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2 h-4 w-4"}),"Sync Category to Shopify"]})})}),jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Confirm Sync to Shopify"}),jsxRuntime.jsxs(DialogDescription,{children:['Are you sure you want to sync the category "',I(),'" to Shopify? This will add all products in this category to your Shopify store.']})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>_(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",onClick:A,disabled:f,children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):"Confirm Sync"})]})]})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4 mb-4",children:C||E?Array.from({length:4}).map((Q,F)=>jsxRuntime.jsx(ProductCard,{},F)):R!=null&&R.Products&&(R==null?void 0:R.Products.length)>0?(z=R==null?void 0:R.Products)==null?void 0:z.map(Q=>jsxRuntime.jsx(ProductCard,{applicationId:t,product:Q,viewProductLink:`/${t}/Product/${Q.RandmarSKU}`,shopifyHostname:n},Q.RandmarSKU)):jsxRuntime.jsxs(Alert,{variant:"warning",className:"col-span-1 @md:col-span-2",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Warning"}),jsxRuntime.jsx(AlertDescription,{children:"No products found for this manufacturer category."})]})})]})}function PartnerRelationshipPage({applicationId:t,partnerId:e,userEmail:n,shopifyHostName:o,isSuperAdmin:l}){var I,M,j;const{data:d,isLoading:f}=useGetV4PartnerByRouteApplicationIdPartnerAndPartnerIdQuery({routeApplicationId:t,partnerId:e,withSpecification:!0}),{toast:g}=useToast(),[b]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdShopifyMutation(),[_,S]=React.useState(!1),[R,C]=React.useState(!1),E=async()=>{try{S(!0),C(!1),await b({routeResellerId:t??"",manufacturerId:e??"",shopifyHostName:o}).unwrap()&&g({title:"Success",description:"Manufacturer synced to Shopify successfully",variant:"success"})}catch(q){console.error("Error syncing to Shopify:",q),g({title:"Error",description:"Error syncing manufacturer to Shopify.",variant:"destructive"})}finally{S(!1)}},A=()=>d!=null&&d.Reseller?"reseller-overview":d!=null&&d.Manufacturer?"manufacturer-overview":"";return jsxRuntime.jsxs("div",{className:"@container",children:[jsxRuntime.jsxs("div",{className:"grid gap-4 grid-cols-1 @md:grid-cols-1 @lg:grid-cols-2",children:[jsxRuntime.jsx(PartnerCard,{account:d,loading:f,withAbout:!0,withVoice:!1,action:" "}),jsxRuntime.jsxs("div",{className:"grid gap-4",children:[((d==null?void 0:d.Manufacturer)||f)&&jsxRuntime.jsx(ManufacturerCard,{manufacturer:d==null?void 0:d.Manufacturer,loading:f,mainAction:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(ManufacturerGetStartedButton,{applicationId:t,manufacturer:d==null?void 0:d.Manufacturer}),o&&((M=(I=d==null?void 0:d.Manufacturer)==null?void 0:I.Categories)==null?void 0:M.findIndex(q=>q.AvailableToBuy))!==-1&&jsxRuntime.jsxs(Dialog,{open:R,onOpenChange:C,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700 ml-2",disabled:_,children:_?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2 h-4 w-4"}),"Sync Manufacturer to Shopify"]})})}),jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Confirm Sync to Shopify"}),jsxRuntime.jsxs(DialogDescription,{children:['Are you sure you want to sync the manufacturer "',(j=d==null?void 0:d.Manufacturer)==null?void 0:j.PublicName,'" to Shopify? This will add all products from this manufacturer to your Shopify store.']})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",onClick:E,disabled:_,children:_?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):"Confirm Sync"})]})]})]})]})}),(d==null?void 0:d.Reseller)&&jsxRuntime.jsx(ResellerCard,{reseller:d==null?void 0:d.Reseller,loading:f})]})]}),((d==null?void 0:d.Reseller)||(d==null?void 0:d.Manufacturer))&&!f&&jsxRuntime.jsx("div",{className:"max-w-6xl mx-auto p-4",children:jsxRuntime.jsxs(Tabs,{defaultValue:A(),className:"w-full",children:[jsxRuntime.jsxs(TabsList,{className:"inline-flex h-auto items-center justify-center rounded-none border-b bg-transparent p-0",children:[(d==null?void 0:d.Reseller)&&jsxRuntime.jsx(TabsTrigger,{value:"reseller-overview",className:"reseller-theme relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Reseller Overview"}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsTrigger,{value:"manufacturer-overview",className:"manufacturer-theme relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Manufacturer Overview"}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsTrigger,{value:"products",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Products"})]}),(d==null?void 0:d.Reseller)&&jsxRuntime.jsx(TabsContent,{value:"reseller-overview",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ResellerOverview,{readonly:!0,appID:d.ApplicationId||"",reseller:d==null?void 0:d.Reseller,userEmail:n,isSuperAdmin:l,withoutReports:!0})})}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsContent,{value:"manufacturer-overview",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ManufacturerOverviewPage,{readonly:!0,manufacturer:d==null?void 0:d.Manufacturer,applicationId:d.ApplicationId||"",userEmail:n})})}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsContent,{value:"products",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ManufacturerProducts,{applicationId:t,manufacturer:d.Manufacturer,shopifyHostName:o})})})]})}),f&&jsxRuntime.jsx("div",{className:"max-w-6xl mx-auto p-4 mt-4 flex justify-center items-center h-32",children:jsxRuntime.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin text-primary"})})]})}function ManufacturerBillingInfoSection({manufacturer:t,readonly:e=!1,isLoading:n,onUnsavedChanges:o}){const{toast:l}=useToast(),[d]=usePostV4PartnerByApplicationIdAccountManufacturerAndFieldNameMutation(),[f,g]=React.useState({}),b=React.useMemo(()=>({accountsPayableRep:(t==null?void 0:t.ContactName)??"",representativeEmail:(t==null?void 0:t.RepresentativeEmail)??"",phone:(t==null?void 0:t.Phone)??"",creditLimit:(t==null?void 0:t.CreditLimit)??0,terms:(t==null?void 0:t.Terms)??""}),[t]),{register:_,handleSubmit:S,reset:R,watch:C,formState:{errors:E,isSubmitting:A}}=useForm({defaultValues:b}),I=C(),M=React.useCallback(()=>e||!f?!1:JSON.stringify(I)!==JSON.stringify(f),[e,I,f]);React.useEffect(()=>{o&&o(M())},[M,o]),React.useEffect(()=>{t&&(R(b),g(b))},[t,R,b]);const j=async q=>{if(e)return;let z=!0,Q=!1;const F=[{key:"accountsPayableRep",apiKey:"ContactName",value:q.accountsPayableRep},{key:"representativeEmail",apiKey:"RepresentativeEmail",value:q.representativeEmail},{key:"phone",apiKey:"Phone",value:q.phone},{key:"terms",apiKey:"Terms",value:q.terms}];for(const O of F){const te=O.value,ne=t==null?void 0:t[O.apiKey];if(te!==ne&&te!==void 0){Q=!0;try{await d({applicationId:(t==null?void 0:t.ManufacturerId)??"",fieldName:O.apiKey,newValue:String(te)}).unwrap()||(z=!1,console.error(`Failed to update ${O.apiKey}`))}catch(ae){console.error(`Error updating ${O.apiKey}:`,ae),z=!1}}}z&&Q?(l({title:"Billing info",description:"Information updated successfully",variant:"success"}),g({...q}),o&&o(!1)):z?Q||l({title:"No changes",description:"No changes were made to the information.",variant:"info"}):l({title:"Update error",description:"Failed to update. Please try again.",variant:"destructive"})};return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Billing, Credit, & Rebates"})}),jsxRuntime.jsx(CardContent,{children:n?jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-16"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-16"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"})]}):jsxRuntime.jsxs("form",{onSubmit:S(j),className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"accountsPayableRep",children:"Accounts Payable Representative"}),jsxRuntime.jsx(Input,{id:"accountsPayableRep",placeholder:"John Doe",..._("accountsPayableRep"),readOnly:e})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"representativeEmail",children:"Representative Email"}),jsxRuntime.jsx(Input,{id:"representativeEmail",placeholder:"john.doe@company.com",..._("representativeEmail",{pattern:{value:/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,message:"Invalid email address"}}),readOnly:e}),E.representativeEmail&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:E.representativeEmail.message})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"phone",children:"Phone"}),jsxRuntime.jsx(Input,{id:"phone",placeholder:"(555) 123-4567",..._("phone"),readOnly:e})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"creditLimit",children:"Credit Limit"}),jsxRuntime.jsx("div",{className:"p-2 border rounded-md bg-gray-100",children:jsxRuntime.jsx(FormattedNumber,{value:(t==null?void 0:t.CreditLimit)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"})})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"terms",children:"Terms"}),jsxRuntime.jsx(Input,{id:"terms",placeholder:"NET 30 DAYS",..._("terms"),readOnly:!0})]}),!e&&jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Button,{type:"submit",disabled:A,className:"w-full sm:w-auto",children:A?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})})]})})]})}function OpenToWorkSection({manufacturer:t,readonly:e=!1,isLoading:n}){const{toast:o}=useToast(),[l]=usePostV4PartnerByApplicationIdAccountManufacturerAndFieldNameMutation(),d=React.useMemo(()=>({openToWork:(t==null?void 0:t.OpenToWork)??!1}),[t]),{reset:f,watch:g}=useForm({defaultValues:d});React.useEffect(()=>{t&&f(d)},[t,f,d]);const b=async _=>{if(!e)try{await l({applicationId:(t==null?void 0:t.ManufacturerId)??"",fieldName:"OpenToWork",newValue:_?"true":"false"}).unwrap()&&o({title:"Open to work info",description:"Information updated successfully",variant:"success"})}catch(S){console.error("Error updating",S)}};return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Open to Work with Resellers"})}),jsxRuntime.jsx(CardContent,{children:n?jsxRuntime.jsx("div",{className:"space-y-4",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"})}):jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Resellers will be introducing their business, and communicating opportunities for your Brand through Randmar."}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"You'll engage directly with resellers, allow them to learn about your product lines, and grow your business faster."}),jsxRuntime.jsx("br",{}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Switch,{id:"openToWork",checked:g("openToWork"),onCheckedChange:_=>b(_),disabled:e}),jsxRuntime.jsx(Label$2,{htmlFor:"openToWork",children:"Open to work with Resellers"})]})]})})]})}const tagSuggestions=["Arts and Crafts","Cleaning Solutions","Clothing","Electronics","Generic Compatible Toner","Ink","Luggage and Bags","Miscellaneous","Networking Devices","Paper Products","Printers","Printing Supplies","Toner"];function ManufacturerPublicInfoSection({manufacturer:t,readonly:e=!1,isLoading:n,onUnsavedChanges:o}){const{toast:l}=useToast(),[d]=usePostV4PartnerByApplicationIdAccountManufacturerAndFieldNameMutation(),[f,g]=React.useState([]),[b,_]=React.useState({}),S=React.useMemo(()=>({publicName:(t==null?void 0:t.PublicName)??"",website:(t==null?void 0:t.Website)??"",customerServiceEmail:(t==null?void 0:t.PublicEmail)??"",publicResources:(t==null?void 0:t.PublicResourcesLink)??""}),[t]),{register:R,handleSubmit:C,reset:E,watch:A,formState:{errors:I,isSubmitting:M}}=useForm({defaultValues:S}),j=A(),q=React.useCallback(()=>e||!b?!1:JSON.stringify(j)!==JSON.stringify(b),[e,j,b]);React.useEffect(()=>{o&&o(q())},[q,o]),React.useEffect(()=>{t&&(E(S),g(t.Tags?t.Tags.split(",").map(O=>O.trim()):[]),_(S))},[t,E,S]);const z=async O=>{if(e)return;let te=!0,ne=!1;const ae=[{key:"publicName",apiKey:"PublicName",value:O.publicName},{key:"website",apiKey:"Website",value:O.website},{key:"manufacturerCategories",apiKey:"Tags",value:f.join(", ")},{key:"customerServiceEmail",apiKey:"PublicEmail",value:O.customerServiceEmail},{key:"publicResources",apiKey:"PublicResourcesLink",value:O.publicResources}];for(const ge of ae){const oe=ge.value,je=t==null?void 0:t[ge.apiKey],Ne=typeof je=="boolean"?String(je):je;if(oe!==Ne&&oe!==void 0){ne=!0;try{await d({applicationId:(t==null?void 0:t.ManufacturerId)??"",fieldName:ge.apiKey,newValue:String(oe)}).unwrap()||(te=!1)}catch(Ae){console.error(`Error updating ${ge.apiKey}:`,Ae),te=!1}}}te&&ne?(l({title:"Public info",description:"Information updated successfully",variant:"success"}),_({...O}),o&&o(!1)):te||l({title:"Update error",description:"Failed to update",variant:"destructive"})},Q=O=>!O||O.trim()==="",F=O=>{g(O)};return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Public Information"})}),jsxRuntime.jsx(CardContent,{children:n?jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[(Q(A("publicName"))||Q(A("website"))||Q(A("customerServiceEmail")))&&jsxRuntime.jsxs(Alert,{variant:"destructive",className:"mb-6",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Missing information"}),jsxRuntime.jsx(AlertDescription,{children:"All fields are required to get started at working with Resellers."})]}),jsxRuntime.jsxs("form",{onSubmit:C(z),className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"publicName",children:"Public Manufacturer Name *"}),jsxRuntime.jsx(Input,{id:"publicName",placeholder:"Company Name",...R("publicName",{}),className:Q(A("publicName"))?"input-error-indicator":"",readOnly:e}),I.publicName&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:I.publicName.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"website",children:"Website *"}),jsxRuntime.jsx(Input,{id:"website",placeholder:"https://company.com",...R("website",{pattern:{value:/^.{7,}$/,message:"Must be at least 7 characters"}}),className:Q(A("website"))?"input-error-indicator":"",readOnly:e}),I.website&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:I.website.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"manufacturerCategories",children:"Manufacturer Categories"}),jsxRuntime.jsx(MultiSelect,{options:tagSuggestions,selected:f,onChange:F,placeholder:"Select or type categories...",disabled:e})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"customerServiceEmail",children:"Customer Service Email *"}),jsxRuntime.jsx(Input,{id:"customerServiceEmail",placeholder:"support@company.com",...R("customerServiceEmail",{pattern:{value:/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,message:"Invalid email address"}}),className:Q(A("customerServiceEmail"))?"input-error-indicator":"",readOnly:e}),I.customerServiceEmail&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:I.customerServiceEmail.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"publicResources",children:"Public Resources"}),jsxRuntime.jsx(Input,{id:"publicResources",placeholder:"https://resources.company.com",...R("publicResources"),readOnly:e})]}),!e&&jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Button,{type:"submit",disabled:M,className:"w-full sm:w-auto",children:M?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})})]})]})})]})}function ManufacturerQualificationsSection({manufacturer:t,readonly:e=!1,isLoading:n,onUnsavedChanges:o}){const{toast:l}=useToast(),[d]=usePostV4PartnerByApplicationIdAccountManufacturerAndFieldNameMutation(),[f,g]=React.useState({}),b=React.useMemo(()=>({partnerPortal:(t==null?void 0:t.PartnerPortal)??"",partnerRegistrationLink:(t==null?void 0:t.PartnerRegistrationLink)??""}),[t]),{register:_,handleSubmit:S,reset:R,watch:C,formState:{errors:E,isSubmitting:A}}=useForm({defaultValues:b}),I=C(),M=React.useCallback(()=>e||!f?!1:JSON.stringify(I)!==JSON.stringify(f),[e,I,f]);React.useEffect(()=>{o&&o(M())},[M,o]),React.useEffect(()=>{t&&(R(b),g(b))},[t,R,b]);const j=async z=>{if(e)return!1;let Q=!0,F=!1;const O=[{key:"partnerPortal",apiKey:"PartnerPortal",value:z.partnerPortal},{key:"partnerRegistrationLink",apiKey:"PartnerRegistrationLink",value:z.partnerRegistrationLink}];for(const te of O){const ne=te.value,ae=t==null?void 0:t[te.apiKey];if(ne!==ae&&ne!==void 0){F=!0;try{await d({applicationId:(t==null?void 0:t.ManufacturerId)??"",fieldName:te.apiKey,newValue:String(ne)}).unwrap()||(Q=!1,console.error(`Failed to update ${te.apiKey}`))}catch(ge){console.error(`Error updating ${te.apiKey}:`,ge),Q=!1}}}Q&&F?(l({title:"Qualifications info",description:"Information updated successfully",variant:"success"}),g({...z}),o&&o(!1)):Q?F||l({title:"No changes",description:"No changes were made to the information.",variant:"info"}):l({title:"Update error",description:"Failed to update. Please try again.",variant:"destructive"})},q=/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?(\?[^\s#]*)??(#[^\s]*)?$/i;return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Qualifications"})}),jsxRuntime.jsx(CardContent,{children:n?jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"})]}):jsxRuntime.jsxs("form",{onSubmit:S(j),className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"partnerPortal",children:"Partner Portal"}),jsxRuntime.jsx(Input,{id:"partnerPortal",placeholder:"https://partner.example.com",..._("partnerPortal",{pattern:{value:q,message:"Invalid URL format"}}),readOnly:e}),E.partnerPortal&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:E.partnerPortal.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"partnerRegistrationLink",children:"Partner Registration Link"}),jsxRuntime.jsx(Input,{id:"partnerRegistrationLink",placeholder:"https://register.example.com",..._("partnerRegistrationLink",{pattern:{value:q,message:"Invalid URL format"}}),readOnly:e}),E.partnerRegistrationLink&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:E.partnerRegistrationLink.message})]}),!e&&jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Button,{type:"submit",disabled:A,className:"w-full sm:w-auto",children:A?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})})]})})]})}function ManufacturerReportsSection({manufacturerId:t,userEmail:e,isLoading:n}){const{toast:o}=useToast(),[l,{isLoading:d}]=usePostV4ManufacturerByRouteManufacturerIdDocumentAndDocumentNumberEmailMutation(),[f,g]=React.useState(null),[b,_]=React.useState(e),[S,R]=React.useState(!1),C=[{name:"Orders & Sales",reports:[{id:"OpenOrders",title:"Open Orders Report",description:"The Open Orders Report provides a snapshot of active orders, aiding your business in efficiently tracking and fulfilling customer demands.",icon:FileText},{id:"Sales",title:"Sales Report",description:"Summary of your company's sales activity over a certain period, detailing total sales and helping identifying trends, successes, and areas needing improvement.",icon:ChartNoAxesColumnIncreasing}]},{name:"Purchase Orders",reports:[{id:"PurchasedOrders",title:"Open Purchase Orders Report",description:"The Open Purchase Orders Report provides a snapshot of Randmar's active orders, aiding your business in efficiently tracking and fulfilling Randmar's inventory demands.",icon:ShoppingCart},{id:"Reorder",title:"Reordering Report",description:"The Reordering Report provides a snapshot of all part numbers auto-reordering statuses. Aiding your understanding of what will be automatically reordered by our system or not once the inventory reaches low numbers.",icon:ClipboardList}]},{name:"Inventory",reports:[{id:"Inventory",title:"Inventory Report",description:"Detailed document outlining the quantity, type, and value of products Randmar has on hand. It aids in managing stock levels, identifying shortages or surpluses, and informing purchasing decisions.",icon:Package},{id:"Products",title:"Products Report",description:"Detailed document outlining all your products properties. It provides a comprehensive overview of essential information and insights that help you make informed decisions.",icon:ClipboardList}]}],E=async I=>{g(I),R(!0)},A=async()=>{if(!(!f||!t))try{await l({routeManufacturerId:t,documentNumber:f.id,emailAddress:b}).unwrap(),o({title:"Report requested",description:`The ${f.title} will be sent to ${b} shortly.`,variant:"success"}),R(!1),_("")}catch(I){console.error("Error requesting report:",I),o({title:"Error",description:"Failed to request report. Please try again.",variant:"destructive"})}};return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reports"}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Download essential business reports, from your Open Orders & Sales Report, to your Inventory Reports."})]}),jsxRuntime.jsx(CardContent,{className:"space-y-6",children:n?jsxRuntime.jsx(jsxRuntime.Fragment,{children:[1,2,3].map(I=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-48"}),[1,2].map(M=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"})]},M))]},I))}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:C.map(I=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold",children:I.name}),I.reports.map(M=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg hover:bg-gray-100 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:jsxRuntime.jsx(M.icon,{className:"h-5 w-5 text-primary"})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h4",{className:"font-semibold text-sm",children:M.title}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:M.description})]}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",className:"flex items-center gap-1",onClick:()=>E(M),children:[jsxRuntime.jsx(Download,{className:"h-4 w-4"}),"Request"]})]},M.id))]},I.name))})}),jsxRuntime.jsx(Dialog,{open:S,onOpenChange:R,children:jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsxs(DialogTitle,{children:["Request ",f==null?void 0:f.title]}),jsxRuntime.jsx(DialogDescription,{children:"Enter the email address where you would like to receive the report."})]}),jsxRuntime.jsxs("div",{className:"py-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",value:b,onChange:I=>_(I.target.value),placeholder:"your@email.com",className:"mt-2"})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>R(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:A,disabled:!b||d,children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):"Send Report"})]})]})})]})}function ManufacturerResellerOrdersSection(t){const{data:e,isLoading:n,isError:o}=useGetV4ManufacturerByRouteManufacturerIdDocumentsActiveOrderDetailsQuery({routeManufacturerId:t.manufacturerId},{skip:!!t.activeOrders||t.isLoading}),l=t.activeOrders??e,f=(()=>{if(!l)return{all:{orders:0,amount:0},processing:{orders:0,amount:0},shipped:{orders:0,amount:0},delayed:{orders:0,amount:0}};const b=l.filter(Q=>Q.DocumentType==="Order"),_=l.filter(Q=>Q.DocumentType==="Shipment"),S=b.filter(Q=>Q.WarehouseCode!=="3PLE"),R=S.reduce((Q,F)=>Q+(F.Quantity||0),0),C=S.reduce((Q,F)=>Q+(F.ExtendedPrice||0),0),E=b.filter(Q=>Q.WarehouseCode==="3PLE"),A=E.reduce((Q,F)=>Q+(F.Quantity||0),0),I=E.reduce((Q,F)=>Q+(F.ExtendedPrice||0),0),M=_.length,j=_.reduce((Q,F)=>Q+(F.ExtendedPrice||0),0),q=R+A+M,z=C+I+j;return{all:{orders:q,amount:z},processing:{orders:R,amount:C},shipped:{orders:M,amount:j},delayed:{orders:A,amount:I}}})(),g=[{name:"All",icon:Package,color:"bg-blue-500",orders:f.all.orders,amount:f.all.amount},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",orders:f.processing.orders,amount:f.processing.amount},{name:"Shipped",icon:Truck,color:"bg-green-500",orders:f.shipped.orders,amount:f.shipped.amount},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",orders:f.delayed.orders,amount:f.delayed.amount}];return n||t.isLoading?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reseller Orders"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-40 mb-4"}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:[1,2,3,4].map(b=>jsxRuntime.jsx(Skeleton,{className:"h-32 w-full"},b))})]})]}):o?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reseller Orders"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsxs(Alert,{variant:"destructive",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Error"}),jsxRuntime.jsx(AlertDescription,{children:"Failed to load reseller orders. Please try again later."})]})})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reseller Orders"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"flex items-center mb-4",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Active Orders:"}),jsxRuntime.jsx("span",{className:"ml-2 font-bold",children:f.all.orders})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:g.map(b=>jsxRuntime.jsx(Card,{className:"overflow-hidden rounded-md rounded-b-lg border-0 shadow-md",children:jsxRuntime.jsxs(CardContent,{className:"p-0",children:[jsxRuntime.jsx("div",{className:`${b.color} bg-opacity-60 h-[3px]`}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-base",children:b.name}),jsxRuntime.jsx("div",{className:`${b.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(b.icon,{className:"size-4 shrink-0 text-white"})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Orders"}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:b.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:jsxRuntime.jsx(FormattedNumber,{value:b.amount,style:"currency",currency:"CAD",currencyDisplay:"symbol"})})]})]})]})]})},b.name))})]})]})}var PROGRESS_NAME="Progress",DEFAULT_MAX=100,[createProgressContext,createProgressScope]=createContextScope(PROGRESS_NAME),[ProgressProvider,useProgressContext]=createProgressContext(PROGRESS_NAME),Progress$1=React__namespace.forwardRef((t,e)=>{const{__scopeProgress:n,value:o=null,max:l,getValueLabel:d=defaultGetValueLabel,...f}=t;(l||l===0)&&!isValidMaxNumber(l)&&console.error(getInvalidMaxError(`${l}`,"Progress"));const g=isValidMaxNumber(l)?l:DEFAULT_MAX;o!==null&&!isValidValueNumber(o,g)&&console.error(getInvalidValueError(`${o}`,"Progress"));const b=isValidValueNumber(o,g)?o:null,_=isNumber$1(b)?d(b,g):void 0;return jsxRuntime.jsx(ProgressProvider,{scope:n,value:b,max:g,children:jsxRuntime.jsx(Primitive.div,{"aria-valuemax":g,"aria-valuemin":0,"aria-valuenow":isNumber$1(b)?b:void 0,"aria-valuetext":_,role:"progressbar","data-state":getProgressState(b,g),"data-value":b??void 0,"data-max":g,...f,ref:e})})});Progress$1.displayName=PROGRESS_NAME;var INDICATOR_NAME="ProgressIndicator",ProgressIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeProgress:n,...o}=t,l=useProgressContext(INDICATOR_NAME,n);return jsxRuntime.jsx(Primitive.div,{"data-state":getProgressState(l.value,l.max),"data-value":l.value??void 0,"data-max":l.max,...o,ref:e})});ProgressIndicator.displayName=INDICATOR_NAME;function defaultGetValueLabel(t,e){return`${Math.round(t/e*100)}%`}function getProgressState(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function isNumber$1(t){return typeof t=="number"}function isValidMaxNumber(t){return isNumber$1(t)&&!isNaN(t)&&t>0}function isValidValueNumber(t,e){return isNumber$1(t)&&!isNaN(t)&&t<=e&&t>=0}function getInvalidMaxError(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${DEFAULT_MAX}\`.`}function getInvalidValueError(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be:
1124
1124
  - a positive number
1125
1125
  - less than the value passed to \`max\` (or ${DEFAULT_MAX} if no \`max\` prop is set)
1126
1126
  - \`null\` or \`undefined\` if the progress is indeterminate.
1127
1127
 
1128
- 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,R)=>S+(R.InventoryValue||0),0),g=d-f,b=Math.round(f/d*100),_=S=>new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2}).format(S);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:_(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:_(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:_(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),f=g=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}).format(g);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:f(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:f(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:f(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 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,I)=>{_(M=>{var j;return((j=M[A])==null?void 0:j.hasUnsavedChanges)!==I.hasUnsavedChanges?(console.log(`Updating form state for ${A}:`,I.hasUnsavedChanges),{...M,[A]:I}):M})},[]),{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 grid-cols-1 @md:grid-cols-1 @lg:grid-cols-2 gap-6",children:[jsxRuntime.jsx(SalesChart,{salesData:(E==null?void 0:E.SalesStatistics)??[],isLoading:f}),jsxRuntime.jsx(ManufacturerResellerOrdersSection,{manufacturerId:t,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:!0}),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:t,userEmail:l,isLoading:f})]}),jsxRuntime.jsx(C,{})]})}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.
1128
+ 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 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,I)=>{_(M=>{var j;return((j=M[A])==null?void 0:j.hasUnsavedChanges)!==I.hasUnsavedChanges?(console.log(`Updating form state for ${A}:`,I.hasUnsavedChanges),{...M,[A]:I}):M})},[]),{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 grid-cols-1 @md:grid-cols-1 @lg:grid-cols-2 gap-6",children:[jsxRuntime.jsx(SalesChart,{salesData:(E==null?void 0:E.SalesStatistics)??[],isLoading:f}),jsxRuntime.jsx(ManufacturerResellerOrdersSection,{manufacturerId:t,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:!0}),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:t,userEmail:l,isLoading:f})]}),jsxRuntime.jsx(C,{})]})}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.
1129
1129
 
1130
1130
  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.
1131
1131
 
@@ -1309,4 +1309,4 @@ img.ProseMirror-separator {
1309
1309
  .ProseMirror p {
1310
1310
  margin-bottom: 0.5em;
1311
1311
  }
1312
- `;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)},[]),I=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]),M=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:M,...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:I,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 SalesChart({salesData:t,chartHeight:e=300,units:n="$",unitsPosition:o="left",className:l,isLoading:d=!1}){const[f,g]=React.useState([]),[b,_]=React.useState(!1),S=!d&&!!t&&t.length>0;return React.useEffect(()=>{if(d||!t||t.length===0){g([]);return}const R=t.reduce((Q,F)=>{const O=F.Day??0,te=Math.floor(O).toString();if(te.length!==8||isNaN(Number.parseInt(te)))return console.warn(`Skipping invalid Day format: ${F.Day}`),Q;const ne=te.substring(0,4),ae=te.substring(4,6),ge=`${ne}-${ae}`;return Q[ge]=(Q[ge]||0)+(F.ExtendedPrice??0),Q},{}),C=Object.keys(R).sort(),E=new Date,A=E.getFullYear(),I=E.getMonth(),M=E.getDate(),j=`${A}-${(I+1).toString().padStart(2,"0")}`,q={...R};if(b&&C.length>0&&C[C.length-1]===j){const Q=q[j],F=new Date(A,I+1,0).getDate();if(M<F&&M>0){const te=Q/M*F;q[j]=te}}const z=C.map(Q=>{const F=q[Q],[O,te]=Q.split("-").map(Number);return{month:new Date(O,te-1).toLocaleString("default",{month:"short",year:"numeric"}),sales:F}});g(z)},[t,b,d]),d?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-24"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{style:{height:e},children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full rounded-md"})}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 my-1 pt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-20"})]}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-3/4 mt-1"})]})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Sales"})}),jsxRuntime.jsx(CardContent,{children:f.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(AreaChart,{data:f,units:n,unitsPosition:o,height:e,className:l}),S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 my-1 pt-2",children:[jsxRuntime.jsx(Switch,{checked:b,onCheckedChange:_,id:"extrapolate-switch","aria-label":"Toggle sales extrapolation"}),jsxRuntime.jsx(Label$2,{htmlFor:"extrapolate-switch",children:"Extrapolate"})]}),b&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"* Sales for the current month are projected, not actual."})]})]}):jsxRuntime.jsx("div",{style:{height:e},className:l||"p-4 text-center text-muted-foreground flex items-center justify-center",children:"No monthly sales data to display."})})]})}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,ae,ge)=>{d(oe=>({...oe,[ne]:{...oe[ne],[ae]:ge}}))},[]),[A]=usePutV4ResellerByRouteResellerIdOpportunityAndManufacturerIdDefaultMutation(),I=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 ae=ne.BidNumber;E(ae,"isSettingDefault",!0),A({routeResellerId:t,manufacturerId:ne.ManufacturerId??"",opportunityNumber:ae}).unwrap().then(()=>{o({title:"Success",description:`Opportunity "${ne.OpportunityName||ne.Opportunity||ae}" 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(ae,"isSettingDefault",!1)})},[t,A,o,E]),[M]=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),M({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(ae=>{var ge;console.error("Send report by email error:",ae),o({title:"Error",description:((ge=ae.data)==null?void 0:ge.message)||ae.message||"An error occurred while sending the report by email.",variant:"destructive"})}).finally(()=>{E(ne,"isSendingReport",!1),f||(R(null),_(""))})},[S,b,t,M,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 ae=ne.original,ge=ae.Active===!0,oe=getEndDateStatus(ae.EndDate);let je="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"?je="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"&&(je="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"}),ae.EndDate&&jsxRuntime.jsx(Badge,{variant:"outline",className:`${je} 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(ae.StartDate)]}),jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"End:"})," ",formatDate(ae.EndDate)]}),jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"Updated:"})," ",formatDate(ae.LastUpdate)]})]})})]})})]})},enableFiltering:!1},{id:"actions",header:"Actions",cell:({row:ne})=>{var $e,Fe;const ae=ne.original;if(!ae.BidNumber)return jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"Actions unavailable"});const ge=ae.BidNumber,oe=($e=l[ge])==null?void 0:$e.isSettingDefault,je=(S==null?void 0:S.BidNumber)===ge&&((Fe=l[ge])==null?void 0:Fe.isSendingReport),Ne=oe||je,Ae=ae.CanBeSetAsDefault===!0;return jsxRuntime.jsxs("div",{className:"flex space-x-2",children:[jsxRuntime.jsx("a",{href:`/${t}/Opportunity/${ae.ManufacturerId}/${ae.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:()=>I(ae),disabled:Ne||!Ae,title:Ae?"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(ae),disabled:Ne,title:"Send report by email",className:"flex items-center",children:[je?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,I,j,S]),Q=React.useMemo(()=>{const ne={};if(e){const ae=Array.from(new Set(e.map(oe=>oe.ManufacturerId).filter(oe=>oe!=null)));ne.ManufacturerId=ae;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||[],O=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:O})]})}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>g(!1),disabled:O,children:"Cancel"}),jsxRuntime.jsxs(Button,{type:"submit",onClick:q,disabled:O,children:[O&&jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"})," Send Report"]})]})]})})]})}function formatYYYYMMDDIntToDateString$1(t){if(t===null||typeof t>"u")return"N/A";const e=t.toString();return e.length===8?`${e.substring(0,4)}-${e.substring(4,6)}-${e.substring(6,8)}`:e}function formatCurrency(t){return t===null||typeof t>"u"?"N/A":t.toLocaleString(void 0,{style:"currency",currency:"CAD"})}function OrdersTable({orders:t=null,loading:e=!1,title:n="Order Details"}){const o=React.useMemo(()=>[{accessorKey:"DocumentNumber",header:"Document Number",cell:({row:f})=>f.original.DocumentNumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"DocumentDate",header:"Document Date",cell:({row:f})=>formatYYYYMMDDIntToDateString$1(f.original.DocumentDate),enableSorting:!0,enableFiltering:!1},{accessorKey:"OrderNumber",header:"Order Number",cell:({row:f})=>f.original.OrderNumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"PONumber",header:"PO Number",cell:({row:f})=>f.original.PONumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"WarehouseCode",header:"Warehouse",cell:({row:f})=>f.original.WarehouseCode??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:f})=>f.original.Quantity??"N/A",enableSorting:!0,enableFiltering:!1},{accessorKey:"ShipToName",header:"Name",cell:({row:f})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:f.original.ShipToName??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"UnitPrice",header:"Unit Price",cell:({row:f})=>formatCurrency(f.original.UnitPrice),enableSorting:!0,enableFiltering:!1}],[]),l=React.useMemo(()=>{const f={};if(t){const g=Array.from(new Set(t.map(C=>C.WarehouseCode).filter(C=>C!=null)));f.WarehouseCode=g;const b=Array.from(new Set(t.map(C=>C.ShipToName).filter(C=>C!=null)));f.ShipToName=b;const _=Array.from(new Set(t.map(C=>C.DocumentNumber).filter(C=>C!=null)));f.DocumentNumber=_;const S=Array.from(new Set(t.map(C=>C.OrderNumber).filter(C=>C!=null)));f.OrderNumber=S;const R=Array.from(new Set(t.map(C=>C.PONumber).filter(C=>C!=null)));f.PONumber=R}return f},[t]),d=t||[];return e?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:n})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:o,data:d,uniqueValues:l})})]})}function formatYYYYMMDDIntToDateString(t){if(t===null||typeof t>"u")return"N/A";const e=t.toString();return e.length===8?`${e.substring(0,4)}-${e.substring(4,6)}-${e.substring(6,8)}`:e}function ReceiptsTable({receipts:t=null,loading:e=!1,title:n="Latest Warehouse Receivings"}){const o=React.useMemo(()=>[{accessorKey:"Location",header:"Location",cell:({row:f})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:f.original.Location??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"ReceiptDate",header:"Date",cell:({row:f})=>formatYYYYMMDDIntToDateString(f.original.ReceiptDate),enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:f})=>f.original.Quantity??"N/A",enableSorting:!0,enableFiltering:!0}],[]),l=React.useMemo(()=>{const f={};if(t){const g=Array.from(new Set(t.map(_=>_.Location).filter(_=>_!=null)));f.Location=g;const b=Array.from(new Set(t.map(_=>formatYYYYMMDDIntToDateString(_.ReceiptDate)).filter(_=>_!=="N/A"&&_!=="Invalid Date"))).sort((_,S)=>new Date(S).getTime()-new Date(_).getTime());f.ReceiptDate=b}return f},[t]),d=t||[];return e?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-56"})," "]}),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:n})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:o,data:d,uniqueValues:l})})]})}function ProductOverviewPage({applicationId:t,sku:e,productDefaultOpportunityNumber:n="",productOnAddToCart:o,productAddingToCart:l=!1,productShopifyHostname:d,productCustomAction:f=jsxRuntime.jsx(jsxRuntime.Fragment,{})}){var C,E,A,I,M,j,q;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=(g==null?void 0:g.ManufacturerId)!==t;return console.log("readonly",R),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 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?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"})}):jsxRuntime.jsxs(Tabs,{defaultValue:"stats",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:!S&&(((C=_==null?void 0:_.SalesStatistics)==null?void 0:C.length)??0)<=0,children:"Statistics"}),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:!S&&(((E=_==null?void 0:_.Opportunities)==null?void 0:E.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:!S&&(((A=_==null?void 0:_.ActiveOrderDetails)==null?void 0:A.length)??0)<=0&&(((I=_==null?void 0:_.CompletedOrderDetails)==null?void 0:I.length)??0)<=0,children:"Orders"}),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:!S&&(((M=_==null?void 0:_.Receipts)==null?void 0:M.length)??0)<=0,children:"Latest Warehouse Receiving"})]}),jsxRuntime.jsx(TabsContent,{value:"stats",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(SalesChart,{salesData:(_==null?void 0:_.SalesStatistics)??[],isLoading:S,units:""})})}),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:[jsxRuntime.jsx("div",{className:"mt-4",children:(S||((j=_==null?void 0:_.ActiveOrderDetails)==null?void 0:j.length)!==0)&&jsxRuntime.jsx(OrdersTable,{title:"Open Orders",orders:_==null?void 0:_.ActiveOrderDetails,loading:S})}),jsxRuntime.jsx("div",{className:"mt-4",children:(S||((q=_==null?void 0:_.CompletedOrderDetails)==null?void 0:q.length)!==0)&&jsxRuntime.jsx(OrdersTable,{title:"Completed Orders",orders:_==null?void 0:_.CompletedOrderDetails,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})})})]})})]})}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.ApiKeyProvider=ApiKeyProvider,exports.AreaChart=AreaChart,exports.Avatar=Avatar,exports.AvatarFallback=AvatarFallback,exports.AvatarFooter=AvatarFooter,exports.AvatarImage=AvatarImage,exports.Badge=Badge,exports.Button=Button,exports.Card=Card,exports.CardContent=CardContent,exports.CardDescription=CardDescription,exports.CardFooter=CardFooter,exports.CardHeader=CardHeader,exports.CardTitle=CardTitle,exports.ChatLayout=ChatLayout,exports.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.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.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.Topbar=Topbar,exports.badgeVariants=badgeVariants,exports.buttonVariants=buttonVariants,exports.toast=toast,exports.useApiKey=useApiKey,exports.useChat=useChat,exports.useIsMobile=useIsMobile,exports.useSidebar=useSidebar,exports.useToast=useToast,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
1312
+ `;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)},[]),I=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]),M=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:M,...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:I,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 SalesChart({salesData:t,chartHeight:e=300,units:n="$",unitsPosition:o="left",className:l,isLoading:d=!1}){const[f,g]=React.useState([]),[b,_]=React.useState(!1),S=!d&&!!t&&t.length>0;return React.useEffect(()=>{if(d||!t||t.length===0){g([]);return}const R=t.reduce((Q,F)=>{const O=F.Day??0,te=Math.floor(O).toString();if(te.length!==8||isNaN(Number.parseInt(te)))return console.warn(`Skipping invalid Day format: ${F.Day}`),Q;const ne=te.substring(0,4),ae=te.substring(4,6),ge=`${ne}-${ae}`;return Q[ge]=(Q[ge]||0)+(F.ExtendedPrice??0),Q},{}),C=Object.keys(R).sort(),E=new Date,A=E.getFullYear(),I=E.getMonth(),M=E.getDate(),j=`${A}-${(I+1).toString().padStart(2,"0")}`,q={...R};if(b&&C.length>0&&C[C.length-1]===j){const Q=q[j],F=new Date(A,I+1,0).getDate();if(M<F&&M>0){const te=Q/M*F;q[j]=te}}const z=C.map(Q=>{const F=q[Q],[O,te]=Q.split("-").map(Number);return{month:new Date(O,te-1).toLocaleString("default",{month:"short",year:"numeric"}),sales:F}});g(z)},[t,b,d]),d?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-24"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{style:{height:e},children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full rounded-md"})}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 my-1 pt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-20"})]}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-3/4 mt-1"})]})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Sales"})}),jsxRuntime.jsx(CardContent,{children:f.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(AreaChart,{data:f,units:n,unitsPosition:o,height:e,className:l}),S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 my-1 pt-2",children:[jsxRuntime.jsx(Switch,{checked:b,onCheckedChange:_,id:"extrapolate-switch","aria-label":"Toggle sales extrapolation"}),jsxRuntime.jsx(Label$2,{htmlFor:"extrapolate-switch",children:"Extrapolate"})]}),b&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"* Sales for the current month are projected, not actual."})]})]}):jsxRuntime.jsx("div",{style:{height:e},className:l||"p-4 text-center text-muted-foreground flex items-center justify-center",children:"No monthly sales data to display."})})]})}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,ae,ge)=>{d(oe=>({...oe,[ne]:{...oe[ne],[ae]:ge}}))},[]),[A]=usePutV4ResellerByRouteResellerIdOpportunityAndManufacturerIdDefaultMutation(),I=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 ae=ne.BidNumber;E(ae,"isSettingDefault",!0),A({routeResellerId:t,manufacturerId:ne.ManufacturerId??"",opportunityNumber:ae}).unwrap().then(()=>{o({title:"Success",description:`Opportunity "${ne.OpportunityName||ne.Opportunity||ae}" 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(ae,"isSettingDefault",!1)})},[t,A,o,E]),[M]=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),M({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(ae=>{var ge;console.error("Send report by email error:",ae),o({title:"Error",description:((ge=ae.data)==null?void 0:ge.message)||ae.message||"An error occurred while sending the report by email.",variant:"destructive"})}).finally(()=>{E(ne,"isSendingReport",!1),f||(R(null),_(""))})},[S,b,t,M,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 ae=ne.original,ge=ae.Active===!0,oe=getEndDateStatus(ae.EndDate);let je="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"?je="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"&&(je="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"}),ae.EndDate&&jsxRuntime.jsx(Badge,{variant:"outline",className:`${je} 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(ae.StartDate)]}),jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"End:"})," ",formatDate(ae.EndDate)]}),jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"Updated:"})," ",formatDate(ae.LastUpdate)]})]})})]})})]})},enableFiltering:!1},{id:"actions",header:"Actions",cell:({row:ne})=>{var $e,Fe;const ae=ne.original;if(!ae.BidNumber)return jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"Actions unavailable"});const ge=ae.BidNumber,oe=($e=l[ge])==null?void 0:$e.isSettingDefault,je=(S==null?void 0:S.BidNumber)===ge&&((Fe=l[ge])==null?void 0:Fe.isSendingReport),Ne=oe||je,Ae=ae.CanBeSetAsDefault===!0;return jsxRuntime.jsxs("div",{className:"flex space-x-2",children:[jsxRuntime.jsx("a",{href:`/${t}/Opportunity/${ae.ManufacturerId}/${ae.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:()=>I(ae),disabled:Ne||!Ae,title:Ae?"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(ae),disabled:Ne,title:"Send report by email",className:"flex items-center",children:[je?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,I,j,S]),Q=React.useMemo(()=>{const ne={};if(e){const ae=Array.from(new Set(e.map(oe=>oe.ManufacturerId).filter(oe=>oe!=null)));ne.ManufacturerId=ae;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||[],O=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:O})]})}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>g(!1),disabled:O,children:"Cancel"}),jsxRuntime.jsxs(Button,{type:"submit",onClick:q,disabled:O,children:[O&&jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"})," Send Report"]})]})]})})]})}function formatYYYYMMDDIntToDateString$1(t){if(t===null||typeof t>"u")return"N/A";const e=t.toString();return e.length===8?`${e.substring(0,4)}-${e.substring(4,6)}-${e.substring(6,8)}`:e}function OrdersTable({orders:t=null,loading:e=!1,title:n="Order Details"}){const o=React.useMemo(()=>[{accessorKey:"DocumentNumber",header:"Document Number",cell:({row:f})=>f.original.DocumentNumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"DocumentDate",header:"Document Date",cell:({row:f})=>formatYYYYMMDDIntToDateString$1(f.original.DocumentDate),enableSorting:!0,enableFiltering:!1},{accessorKey:"OrderNumber",header:"Order Number",cell:({row:f})=>f.original.OrderNumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"PONumber",header:"PO Number",cell:({row:f})=>f.original.PONumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"WarehouseCode",header:"Warehouse",cell:({row:f})=>f.original.WarehouseCode??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:f})=>f.original.Quantity??"N/A",enableSorting:!0,enableFiltering:!1},{accessorKey:"ShipToName",header:"Name",cell:({row:f})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:f.original.ShipToName??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"UnitPrice",header:"Unit Price",cell:({row:f})=>f.original.UnitPrice?formatMoney(f.original.UnitPrice):"N/A",enableSorting:!0,enableFiltering:!1}],[]),l=React.useMemo(()=>{const f={};if(t){const g=Array.from(new Set(t.map(C=>C.WarehouseCode).filter(C=>C!=null)));f.WarehouseCode=g;const b=Array.from(new Set(t.map(C=>C.ShipToName).filter(C=>C!=null)));f.ShipToName=b;const _=Array.from(new Set(t.map(C=>C.DocumentNumber).filter(C=>C!=null)));f.DocumentNumber=_;const S=Array.from(new Set(t.map(C=>C.OrderNumber).filter(C=>C!=null)));f.OrderNumber=S;const R=Array.from(new Set(t.map(C=>C.PONumber).filter(C=>C!=null)));f.PONumber=R}return f},[t]),d=t||[];return e?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:n})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:o,data:d,uniqueValues:l})})]})}function formatYYYYMMDDIntToDateString(t){if(t===null||typeof t>"u")return"N/A";const e=t.toString();return e.length===8?`${e.substring(0,4)}-${e.substring(4,6)}-${e.substring(6,8)}`:e}function ReceiptsTable({receipts:t=null,loading:e=!1,title:n="Latest Warehouse Receivings"}){const o=React.useMemo(()=>[{accessorKey:"Location",header:"Location",cell:({row:f})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:f.original.Location??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"ReceiptDate",header:"Date",cell:({row:f})=>formatYYYYMMDDIntToDateString(f.original.ReceiptDate),enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:f})=>f.original.Quantity??"N/A",enableSorting:!0,enableFiltering:!0}],[]),l=React.useMemo(()=>{const f={};if(t){const g=Array.from(new Set(t.map(_=>_.Location).filter(_=>_!=null)));f.Location=g;const b=Array.from(new Set(t.map(_=>formatYYYYMMDDIntToDateString(_.ReceiptDate)).filter(_=>_!=="N/A"&&_!=="Invalid Date"))).sort((_,S)=>new Date(S).getTime()-new Date(_).getTime());f.ReceiptDate=b}return f},[t]),d=t||[];return e?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-56"})," "]}),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:n})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:o,data:d,uniqueValues:l})})]})}function ProductOverviewPage({applicationId:t,sku:e,productDefaultOpportunityNumber:n="",productOnAddToCart:o,productAddingToCart:l=!1,productShopifyHostname:d,productCustomAction:f=jsxRuntime.jsx(jsxRuntime.Fragment,{})}){var C,E,A,I,M,j,q;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=(g==null?void 0:g.ManufacturerId)!==t;return console.log("readonly",R),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 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?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"})}):jsxRuntime.jsxs(Tabs,{defaultValue:"stats",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:!S&&(((C=_==null?void 0:_.SalesStatistics)==null?void 0:C.length)??0)<=0,children:"Statistics"}),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:!S&&(((E=_==null?void 0:_.Opportunities)==null?void 0:E.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:!S&&(((A=_==null?void 0:_.ActiveOrderDetails)==null?void 0:A.length)??0)<=0&&(((I=_==null?void 0:_.CompletedOrderDetails)==null?void 0:I.length)??0)<=0,children:"Orders"}),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:!S&&(((M=_==null?void 0:_.Receipts)==null?void 0:M.length)??0)<=0,children:"Latest Warehouse Receiving"})]}),jsxRuntime.jsx(TabsContent,{value:"stats",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(SalesChart,{salesData:(_==null?void 0:_.SalesStatistics)??[],isLoading:S,units:""})})}),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:[jsxRuntime.jsx("div",{className:"mt-4",children:(S||((j=_==null?void 0:_.ActiveOrderDetails)==null?void 0:j.length)!==0)&&jsxRuntime.jsx(OrdersTable,{title:"Open Orders",orders:_==null?void 0:_.ActiveOrderDetails,loading:S})}),jsxRuntime.jsx("div",{className:"mt-4",children:(S||((q=_==null?void 0:_.CompletedOrderDetails)==null?void 0:q.length)!==0)&&jsxRuntime.jsx(OrdersTable,{title:"Completed Orders",orders:_==null?void 0:_.CompletedOrderDetails,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})})})]})})]})}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.ApiKeyProvider=ApiKeyProvider,exports.AreaChart=AreaChart,exports.Avatar=Avatar,exports.AvatarFallback=AvatarFallback,exports.AvatarFooter=AvatarFooter,exports.AvatarImage=AvatarImage,exports.Badge=Badge,exports.Button=Button,exports.Card=Card,exports.CardContent=CardContent,exports.CardDescription=CardDescription,exports.CardFooter=CardFooter,exports.CardHeader=CardHeader,exports.CardTitle=CardTitle,exports.ChatLayout=ChatLayout,exports.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.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.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.Topbar=Topbar,exports.badgeVariants=badgeVariants,exports.buttonVariants=buttonVariants,exports.toast=toast,exports.useApiKey=useApiKey,exports.useChat=useChat,exports.useIsMobile=useIsMobile,exports.useSidebar=useSidebar,exports.useToast=useToast,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});